migrate from EPICS 3.14.12 to 7.0.7
This commit is contained in:
14
Makefile
14
Makefile
@@ -1,10 +1,20 @@
|
||||
include /ioc/tools/driver.makefile
|
||||
MODULE = $(notdir $(shell pwd))
|
||||
BUILDCLASSES = Linux
|
||||
ARCH_FILTER = eldk42% SL6-x86_64
|
||||
EXCLUDE_VERSIONS = 7
|
||||
ARCH_FILTER = eldk42%
|
||||
EXCLUDE_VERSIONS = 3.14 7.0.6
|
||||
#EPICS_VERSIONS = 7.0.7
|
||||
|
||||
#SCRIPTS+=$(wildcard add_EXPMX*.cmd cfg/*.cfg cfg/*.py cfg/*.pbi python/*.py)
|
||||
SCRIPTS+=$(wildcard add_EXPMX*.cmd cfg/*.cfg cfg/*.py cfg/*.pbi)
|
||||
#SOURCES+=src/DHVSaSub.cpp
|
||||
#DBDS+=src/DHVSaSub.dbd
|
||||
USR_CXXFLAGS+= -fno-operator-names
|
||||
|
||||
.PHONY: install_ioc generate
|
||||
|
||||
install_ioc: generate
|
||||
cd gen/ioc;make install
|
||||
|
||||
generate:
|
||||
/opt/gfa/python-3.5/latest/bin/python generate.py -m 0xf
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
### Required Parameters ###
|
||||
#PORT='PPMAC1'
|
||||
#P='SARFE10-OAPU090'
|
||||
#powerPmacCreateController(<port_name>, <moving_poll_pseriod [ms]>, <idle_poll_period [ms]>)
|
||||
#powerPmacCreateController("$(PORT)", 100, 100) <<< done in commom module
|
||||
###########################
|
||||
require gpasciiCommander
|
||||
! $(gpasciiCommander_DIR)/gpasciiCommander --path $(ESB_MX_DIR) $(ESB_MX_DIR)/$(P)1.cfg
|
||||
|
||||
powerPmacCreateAxis($(PORT), 1)
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
### Required Parameters ###
|
||||
#PORT='PPMAC1'
|
||||
#P='SARFE10-OAPU090'
|
||||
#powerPmacCreateController(<port_name>, <moving_poll_pseriod [ms]>, <idle_poll_period [ms]>)
|
||||
#powerPmacCreateController("$(PORT)", 100, 100) <<< done in commom module
|
||||
###########################
|
||||
require gpasciiCommander
|
||||
! $(gpasciiCommander_DIR)/gpasciiCommander --path $(ESB_MX_DIR) $(ESB_MX_DIR)/$(P)2.cfg
|
||||
|
||||
powerPmacCreateAxis($(PORT), 1)
|
||||
@@ -23,6 +17,5 @@ powerPmacCreateVirtualAxis("$(PORT)", 10, 1, "Y",1,2,3,4)
|
||||
powerPmacCreateVirtualAxis("$(PORT)", 11, 1, "A",1,2,3,4)
|
||||
powerPmacCreateVirtualAxis("$(PORT)", 12, 1, "B",1,2,3,4)
|
||||
|
||||
|
||||
# Load databse
|
||||
dbLoadTemplate("$(ESB_MX_TEMPLATES)/$(P)2.subs", "PORT_M=$(PORT),P_M=$(P)")
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
### Required Parameters ###
|
||||
#PORT='PPMAC1'
|
||||
#P='SARFE10-OAPU090'
|
||||
#powerPmacCreateController(<port_name>, <moving_poll_pseriod [ms]>, <idle_poll_period [ms]>)
|
||||
#powerPmacCreateController("$(PORT)", 100, 100) <<< done in commom module
|
||||
###########################
|
||||
require stream
|
||||
require gpasciiCommander
|
||||
! $(gpasciiCommander_DIR)/gpasciiCommander --path $(ESB_MX_DIR) $(ESB_MX_DIR)/$(P)3.cfg
|
||||
|
||||
powerPmacCreateAxis($(PORT), 1)
|
||||
@@ -25,26 +18,23 @@ powerPmacCreateVirtualAxis("$(PORT)", 11, 1, "U",1,2,3,4)
|
||||
powerPmacCreateVirtualAxis("$(PORT)", 12, 1, "V",1,2,3,4)
|
||||
powerPmacCreateVirtualAxis("$(PORT)", 13, 1, "W",1,2,3,4)
|
||||
|
||||
|
||||
powerPmacSetCustomMotion $(PORT) 1 1
|
||||
powerPmacSetCustomMotion $(PORT) 2 1
|
||||
powerPmacSetCustomMotion $(PORT) 3 1
|
||||
powerPmacSetCustomMotion $(PORT) 4 1
|
||||
powerPmacSetCustomMotion $(PORT) 5 1
|
||||
powerPmacSetCustomMotion $(PORT) 9 1
|
||||
powerPmacSetCustomMotion $(PORT) 10 1
|
||||
powerPmacSetCustomMotion $(PORT) 11 1
|
||||
powerPmacSetCustomMotion $(PORT) 12 1
|
||||
powerPmacSetCustomMotion $(PORT) 13 1
|
||||
|
||||
# Load databse
|
||||
dbLoadTemplate("$(ESB_MX_TEMPLATES)/$(P)3.subs", "PORT_M=$(PORT),P_M=$(P)")
|
||||
|
||||
epicsEnvSet STREAM_PROTOCOL_PATH, $(STREAM_PROTOCOL_PATH):$(ESB_MX_DIR)
|
||||
|
||||
#asynSetTraceMask("$(PORT)", -1, 0x6)
|
||||
#asynSetTraceIOMask("$(PORT)", -1, 0x2)
|
||||
var streamError 1
|
||||
#var streamDebug 1
|
||||
require PB_EXTRA
|
||||
#- Brakes - need to load motor status PVs as well
|
||||
dbLoadRecords("$(PB_EXTRA_TEMPLATES)motorStatus.db" "SYS=${P}, PORT=${PORT}, M=MOT_GIR_1, M_NO=1")
|
||||
dbLoadRecords("$(PB_EXTRA_TEMPLATES)motorStatus.db" "SYS=${P}, PORT=${PORT}, M=MOT_GIR_2, M_NO=2")
|
||||
dbLoadRecords("$(PB_EXTRA_TEMPLATES)motorStatus.db" "SYS=${P}, PORT=${PORT}, M=MOT_GIR_3, M_NO=3")
|
||||
dbLoadRecords("$(PB_EXTRA_TEMPLATES)motorStatus.db" "SYS=${P}, PORT=${PORT}, M=MOT_GIR_4, M_NO=4")
|
||||
dbLoadRecords("$(PB_EXTRA_TEMPLATES)motorStatus.db" "SYS=${P}, PORT=${PORT}, M=MOT_GIR_5, M_NO=5")
|
||||
dbLoadRecords("${PB_EXTRA_TEMPLATES}motorBrake.db", "SYS=${P}, PORT=${PORT}, M=MOT_GIR_1, M_NO=1")
|
||||
dbLoadRecords("${PB_EXTRA_TEMPLATES}motorBrake.db", "SYS=${P}, PORT=${PORT}, M=MOT_GIR_2, M_NO=2")
|
||||
dbLoadRecords("${PB_EXTRA_TEMPLATES}motorBrake.db", "SYS=${P}, PORT=${PORT}, M=MOT_GIR_3, M_NO=3")
|
||||
dbLoadRecords("${PB_EXTRA_TEMPLATES}motorBrake.db", "SYS=${P}, PORT=${PORT}, M=MOT_GIR_4, M_NO=4")
|
||||
dbLoadRecords("${PB_EXTRA_TEMPLATES}motorBrake.db", "SYS=${P}, PORT=${PORT}, M=MOT_GIR_5, M_NO=5")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ open plc PLC_Homing
|
||||
Motor[1].FatalFeLimit=2000
|
||||
L12=Motor[1].JogSpeed
|
||||
Motor[1].JogSpeed=1
|
||||
L13=Motor[1].pEncLoss
|
||||
Motor[1].pEncLoss=0
|
||||
|
||||
L20=Motor[2].MaxDac
|
||||
Motor[2].MaxDac=500
|
||||
@@ -28,6 +30,8 @@ open plc PLC_Homing
|
||||
Motor[2].FatalFeLimit=2000
|
||||
L22=Motor[2].JogSpeed
|
||||
Motor[2].JogSpeed=1
|
||||
L23=Motor[2].pEncLoss
|
||||
Motor[2].pEncLoss=0
|
||||
|
||||
|
||||
Motor[1].PhaseFindingStep=1
|
||||
@@ -119,9 +123,12 @@ N1: //ENDPLC
|
||||
Motor[1].MaxDac=L10
|
||||
Motor[1].FatalFeLimit=L11
|
||||
Motor[1].JogSpeed=L12
|
||||
Motor[1].pEncLoss=L13
|
||||
|
||||
Motor[2].MaxDac=L20
|
||||
Motor[2].FatalFeLimit=L21
|
||||
Motor[2].JogSpeed=L22
|
||||
Motor[2].pEncLoss=L23
|
||||
send 1"homeing done\n"
|
||||
|
||||
disable plc PLC_Homing
|
||||
|
||||
@@ -8,24 +8,26 @@
|
||||
//#5: homeoffset: -47956.2759182
|
||||
|
||||
!encoder_ssi(enc=1,numBits=18,posSf=-5625./4096)
|
||||
//!motor(mot=1,dirCur=1000,JogSpeed=40,servoSf=256./9.,Pos2Sf=0,InPosBand=0,FatalFeLimit=1000,HomeOffset=0.)
|
||||
!motor(mot=1,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=65477.)
|
||||
!motor(mot=1,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=10,FatalFeLimit=1000,HomeOffset=65477.,FaultMode=0)
|
||||
|
||||
!encoder_ssi(enc=2,numBits=18,posSf=-5625./4096)
|
||||
//!motor(mot=2,dirCur=1000,JogSpeed=40,servoSf=256./9.,Pos2Sf=0,InPosBand=0,FatalFeLimit=1000,HomeOffset=0.)
|
||||
!motor(mot=2,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=-154370.)
|
||||
!motor(mot=2,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=10,FatalFeLimit=1000,HomeOffset=-154370.,FaultMode=0)
|
||||
|
||||
!encoder_ssi(enc=3,numBits=18,posSf=-5625./4096)
|
||||
//!motor(mot=3,dirCur=1000,JogSpeed=40,servoSf=256./9.,Pos2Sf=0,InPosBand=0,FatalFeLimit=1000,HomeOffset=0.)
|
||||
!motor(mot=3,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=-5248.)
|
||||
!motor(mot=3,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=10,FatalFeLimit=1000,HomeOffset=-5248.,FaultMode=0)
|
||||
|
||||
!encoder_ssi(enc=4,numBits=18,posSf=-5625./4096)
|
||||
//!motor(mot=4,dirCur=1000,JogSpeed=40,servoSf=256./9.,Pos2Sf=0,InPosBand=0,FatalFeLimit=1000,HomeOffset=0.)
|
||||
!motor(mot=4,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=-46620.)
|
||||
!motor(mot=4,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=10,FatalFeLimit=1000,HomeOffset=-46620.,FaultMode=0)
|
||||
|
||||
!encoder_ssi(enc=5,numBits=18,posSf=-5625./4096)
|
||||
//!motor(mot=5,dirCur=1000,JogSpeed=40,servoSf=256./9.,Pos2Sf=0,InPosBand=0,FatalFeLimit=1000,HomeOffset=0.)
|
||||
!motor(mot=5,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=93168.)
|
||||
!motor(mot=5,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=10,FatalFeLimit=1000,HomeOffset=93168.,FaultMode=0)
|
||||
|
||||
Motor[1].Servo.BreakPosErr=0
|
||||
Motor[2].Servo.BreakPosErr=0
|
||||
Motor[3].Servo.BreakPosErr=0
|
||||
Motor[4].Servo.BreakPosErr=0
|
||||
Motor[5].Servo.BreakPosErr=0
|
||||
|
||||
|
||||
// PKP266D14BA2 1.4A 1.8deb/step
|
||||
//!encoder_sim(enc=6)
|
||||
@@ -38,64 +40,37 @@
|
||||
!encoder_sim(enc=6,posSf=2000./102400)
|
||||
!motor(mot=6,dirCur=1400,servoSf=102400./2000,invDir=False,JogSpeed=2,InPosBand=1,FatalFeLimit=1000,HomeOffset=0.)
|
||||
|
||||
define(SP_RelBrk='15',SP_LockBrk='16')
|
||||
|
||||
// ---------- Custom Motion Programs ----------
|
||||
// break configuration
|
||||
// at the beginning brakes were handeled with 'custom motion', but this has been removed,
|
||||
// as it was possible to cofigure simple brake handling with the motor on a better approach
|
||||
// s.a. following implementation
|
||||
// ~/Documents/prj/SwissFEL/epics_ioc_modules/PBPG/cfg/motEnc-PBPG050.cfg
|
||||
//!holding_current template not needed. The brake stuff below turns off the amplifiers
|
||||
// brake
|
||||
// PowerBrick[0].GpioData[0].16 is GPIO-OUT[1]
|
||||
|
||||
!cm_prem_post(ax=1,prem=15,post=16) //generates subprog 10,11,12,13
|
||||
!cm_prem_post(ax=2,prem=15,post=16) //generates subprog 20,21,22,23
|
||||
!cm_prem_post(ax=3,prem=15,post=16) //generates subprog 30,31,32,33
|
||||
!cm_prem_post(ax=4,prem=15,post=16) //generates subprog 40,41,42,43
|
||||
!cm_prem_post(ax=5,prem=15,post=16) //generates subprog 40,41,42,43
|
||||
Motor[1].pBrakeOut = PowerBrick[0].GpioData[0].a // put proper reference to gpio here !!!
|
||||
Motor[1].BrakeOutBit = 16
|
||||
Motor[1].BrakeOffDelay = 100 // delay in ms before the brake is released after motion was triggered
|
||||
Motor[1].BrakeOnDelay = 100 // delay in ms before the amplifier is disabled after motion has stopped
|
||||
|
||||
!cm_prem_post(ax='X',axid=9,prem=15,post=16) //generates subprog 90,91,92,93
|
||||
!cm_prem_post(ax='Y',axid=10,prem=15,post=16) //generates subprog 100,101,102,103
|
||||
!cm_prem_post(ax='U',axid=11,prem=15,post=16) //generates subprog 110,111,112,113
|
||||
!cm_prem_post(ax='V',axid=12,prem=15,post=16) //generates subprog 120,121,122,123
|
||||
!cm_prem_post(ax='W',axid=13,prem=15,post=16) //generates subprog 120,121,122,123
|
||||
Motor[2].pBrakeOut = PowerBrick[0].GpioData[0].a // put proper reference to gpio here !!!
|
||||
Motor[2].BrakeOutBit = 17
|
||||
Motor[2].BrakeOffDelay = 100 // delay in ms before the brake is released after motion was triggered
|
||||
Motor[2].BrakeOnDelay = 100 // delay in ms before the amplifier is disabled after motion has stopped
|
||||
|
||||
// ---------- PREM POST Programs ----------
|
||||
|
||||
//prem
|
||||
open subprog SP_RelBrk
|
||||
define(EndTime='L1'); // Local variable
|
||||
Motor[1].IdCmd=1000;Motor[1].InPosBand=2
|
||||
Motor[2].IdCmd=1000;Motor[2].InPosBand=2
|
||||
Motor[3].IdCmd=1000;Motor[3].InPosBand=2
|
||||
Motor[4].IdCmd=1000;Motor[4].InPosBand=2
|
||||
Motor[5].IdCmd=1000;Motor[5].InPosBand=2
|
||||
PowerBrick[0].GpioData[0].16.5=$1f
|
||||
//send 1"wait\n"
|
||||
//EndTime = Sys.Time + .1; // time + 10 sec.
|
||||
//while (EndTime > Sys.Time){}
|
||||
//send 1"wait done\n"
|
||||
close
|
||||
|
||||
//post
|
||||
open subprog SP_LockBrk
|
||||
define(EndTime='L1'); // Local variable
|
||||
//wait until all motors are in pos
|
||||
EndTime = Sys.Time + 10; // time + 10 sec.
|
||||
//send 1"wait."
|
||||
while (EndTime > Sys.Time)
|
||||
{
|
||||
if(Coord[1].InPos)
|
||||
{
|
||||
//send 1"inPos\n"
|
||||
break
|
||||
}
|
||||
//if(Motor[1].InPos && Motor[2].InPos&& Motor[3].InPos&& Motor[4].InPos&& Motor[5].InPos)
|
||||
// break
|
||||
//send 1"."
|
||||
}
|
||||
//send 1"done\n"
|
||||
|
||||
Motor[1].IdCmd=0;Motor[1].InPosBand=50
|
||||
Motor[2].IdCmd=0;Motor[2].InPosBand=50
|
||||
Motor[3].IdCmd=0;Motor[3].InPosBand=50
|
||||
Motor[4].IdCmd=0;Motor[4].InPosBand=50
|
||||
Motor[5].IdCmd=0;Motor[5].InPosBand=50
|
||||
PowerBrick[0].GpioData[0].16.5=$0
|
||||
close
|
||||
Motor[3].pBrakeOut = PowerBrick[0].GpioData[0].a // put proper reference to gpio here !!!
|
||||
Motor[3].BrakeOutBit = 18
|
||||
Motor[3].BrakeOffDelay = 100 // delay in ms before the brake is released after motion was triggered
|
||||
Motor[3].BrakeOnDelay = 100 // delay in ms before the amplifier is disabled after motion has stopped
|
||||
|
||||
Motor[4].pBrakeOut = PowerBrick[0].GpioData[0].a // put proper reference to gpio here !!!
|
||||
Motor[4].BrakeOutBit = 19
|
||||
Motor[4].BrakeOffDelay = 100 // delay in ms before the brake is released after motion was triggered
|
||||
Motor[4].BrakeOnDelay = 100 // delay in ms before the amplifier is disabled after motion has stopped
|
||||
|
||||
Motor[5].pBrakeOut = PowerBrick[0].GpioData[0].a // put proper reference to gpio here !!!
|
||||
Motor[5].BrakeOutBit = 20
|
||||
Motor[5].BrakeOffDelay = 100 // delay in ms before the brake is released after motion was triggered
|
||||
Motor[5].BrakeOnDelay = 100 // delay in ms before the amplifier is disabled after motion has stopped
|
||||
|
||||
@@ -26,15 +26,6 @@ Coord[1].AltFeedRate=1000
|
||||
Coord[1].Tm=-10000 //1000um/FeedTime -> 1mm/sec
|
||||
Coord[1].FeedTime=1000 //default value 1000um
|
||||
|
||||
//motor current off (as cpxcall 16)
|
||||
Motor[1].IdCmd=0;Motor[1].InPosBand=10
|
||||
Motor[2].IdCmd=0;Motor[2].InPosBand=10
|
||||
Motor[3].IdCmd=0;Motor[3].InPosBand=10
|
||||
Motor[4].IdCmd=0;Motor[4].InPosBand=10
|
||||
Motor[5].IdCmd=0;Motor[5].InPosBand=10
|
||||
|
||||
//#1..5hmz
|
||||
//#1..5j/
|
||||
&1
|
||||
|
||||
//initialization code
|
||||
@@ -60,8 +51,9 @@ close // plc 1
|
||||
|
||||
enable plc 1
|
||||
|
||||
#1..5dkill
|
||||
|
||||
//motor 1..5 use custom code to kill motor and use brake
|
||||
//motor 1..5 use break setup to kill motor
|
||||
!holding_current(m6=[0,700])
|
||||
|
||||
|
||||
|
||||
148
generate.py
Executable file
148
generate.py
Executable file
@@ -0,0 +1,148 @@
|
||||
#!/usr/bin/env python
|
||||
#*-----------------------------------------------------------------------*
|
||||
#| |
|
||||
#| Copyright (c) 2019 by Paul Scherrer Institute (http://www.psi.ch) |
|
||||
#| |
|
||||
#| Author Thierry Zamofing (thierry.zamofing@psi.ch) |
|
||||
#*-----------------------------------------------------------------------*
|
||||
'''
|
||||
generate .subs and _startup.script files
|
||||
mode bits:
|
||||
0x001: genIOC()
|
||||
0x008: genLauncher()
|
||||
|
||||
Long Doc'''
|
||||
from __future__ import print_function
|
||||
|
||||
import logging, sys, os, json
|
||||
import string
|
||||
|
||||
host2param={
|
||||
#HOST runScript
|
||||
'SAR-CPPM-EXPMX1': ('require ESB_MX\nrunScript $(ESB_MX_DIR)/add_EXPMX1.cmd "P=SAR-EXPMX,PORT=PPMAC1"',),
|
||||
'SAR-CPPM-EXPMX2': ('require ESB_MX\nrunScript $(ESB_MX_DIR)/add_EXPMX2.cmd "P=SAR-EXPMX,PORT=PPMAC1"',),
|
||||
'SAR-CPPM-EXPMX3': ('require ESB_MX\nrunScript $(ESB_MX_DIR)/add_EXPMX3.cmd "P=SAR-EXPMX,PORT=PPMAC1"',),
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
tplYaml='''\
|
||||
cpu_architecture: {os}
|
||||
os: {os}
|
||||
os_id: {os}
|
||||
epics_version: 7.0.7
|
||||
ioc_host: {host}
|
||||
ioc_port: {port}
|
||||
'''
|
||||
|
||||
##################################################################
|
||||
# DO NOT EDIT: Generated with epics_ioc_modules/OATT/generate.py
|
||||
# This is the IOC on "{host}" port {port}:
|
||||
##################################################################
|
||||
tplScriptPowerBrickIOC='''\
|
||||
#####################################
|
||||
# PPMAC responsible: Thierry Zamofing
|
||||
#####################################
|
||||
{req}
|
||||
|
||||
############################################
|
||||
#------! Common PPMAC configuration !------#
|
||||
############################################
|
||||
# Load common configuration
|
||||
require PB_COMMON
|
||||
|
||||
# Define controller
|
||||
#powerPmacCreateController(<port_name>, <moving_poll_pseriod [ms]>, <idle_poll_period [ms]>)
|
||||
powerPmacCreateController("PPMAC1", 200, 1000)
|
||||
|
||||
############################################
|
||||
#--------! Devices configuration ---------!#
|
||||
############################################
|
||||
{devConf}
|
||||
'''
|
||||
|
||||
tplEVR='''\
|
||||
####### initialise EVR ##############################
|
||||
# https://git.psi.ch/epics_driver_modules/mrfioc2
|
||||
require mrfioc2
|
||||
runScript $(mrfioc2_DIR)/mrfioc2_evr-PCIe.cmd, "DEVICE=EVR0,EVR_SUBS=$(ESB_MX_DIR)/db/evr_PCIe-300DC.subs,EVR_DOMAIN=0x2,EVR_BUS=0x21,SYS=SAR-EXPMX"
|
||||
|
||||
####### initialise EVR data buffer ##################
|
||||
# https://git.psi.ch/epics_driver_modules/mrfioc2_regDev
|
||||
require mrfioc2_regDev
|
||||
runScript $(mrfioc2_regDev_DIR)/mrfioc2_regDev_pulseID_RX.cmd, "DEVICE=EVR0,SYS=SAR-EXPMX"
|
||||
'''
|
||||
|
||||
|
||||
class CPPM:
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def genIOC(self):
|
||||
print('### genIOC ###')
|
||||
tpl=tplScriptPowerBrickIOC
|
||||
|
||||
os.makedirs('gen/ioc/',exist_ok=True)
|
||||
#os.makedirs('gen/db/',exist_ok=True)
|
||||
|
||||
fh=open('gen/ioc/Makefile','w')
|
||||
fh.write('include /ioc/tools/ioc.makefile\n')
|
||||
fh.close()
|
||||
|
||||
port=50001
|
||||
osys='eldk42-ppc4xxFP'
|
||||
|
||||
for host,v in host2param.items():
|
||||
devConf,=v
|
||||
req=''
|
||||
|
||||
fn='gen/ioc/{host}_startup.script'.format(host=host)
|
||||
print('generate '+fn+'...')
|
||||
fh=open(fn,'w')
|
||||
fh.write(tpl.format(host=host,port=port,req=req,devConf=devConf))
|
||||
if host=='SAR-CPPM-EXPMX1':
|
||||
fh.write(tplEVR)
|
||||
fh.close()
|
||||
fn='gen/ioc/{host}_parameters.yaml'.format(host=host)
|
||||
print('generate '+fn+'...')
|
||||
fh=open(fn,'w')
|
||||
fh.write(tplYaml.format(os=osys,host=host,port=port))
|
||||
fh.close()
|
||||
print('done.')
|
||||
|
||||
def genLauncher(self):
|
||||
print('### genLauncher ###')
|
||||
|
||||
# os.makedirs('gen/',exist_ok=True)
|
||||
# fn='gen/launcher_part.json'
|
||||
# print('generate '+fn+'...')
|
||||
# fh=open(fn,'w')
|
||||
# for dev,ioc in dev2ioc.items():
|
||||
# fh.write('''\
|
||||
#{{ "type": "caqtdm" , "text": "{dev} translation", "panel": "galil_dmc_ctrl.ui", "macros": "DMC={dev}_DMC1:,M1=TX" }},
|
||||
#'''.format(dev=dev))
|
||||
# fh.close()
|
||||
|
||||
if __name__=='__main__':
|
||||
def parse_args():
|
||||
import argparse
|
||||
(h, t)=os.path.split(sys.argv[0]);cmd='\n '+(t if len(h)>20 else sys.argv[0])+' '
|
||||
#print(sys.argv,h,t)
|
||||
exampleCmd=('', '-m0xf -v0' )
|
||||
epilog=__doc__+'\nExamples:'+''.join(map(lambda s:cmd+s, exampleCmd))+'\n'
|
||||
|
||||
parser = argparse.ArgumentParser(epilog=epilog,formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
parser.add_argument('-m', '--mode', type=lambda x: int(x,0), help='mode bits', default=0xff)
|
||||
args = parser.parse_args()
|
||||
#print(args)
|
||||
|
||||
obj=CPPM()
|
||||
if args.mode&0x1:
|
||||
obj.genIOC()
|
||||
if args.mode&0x2:
|
||||
obj.genLauncher()
|
||||
|
||||
parse_args()
|
||||
|
||||
Reference in New Issue
Block a user