### 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)
powerPmacCreateAxis($(PORT), 2)
powerPmacCreateAxis($(PORT), 3)
powerPmacCreateAxis($(PORT), 4)
powerPmacCreateAxis($(PORT), 5)
#powerPmacCreateAxis($(PORT), 6)
#powerPmacCreateAxis($(PORT), 7)
#powerPmacCreateAxis($(PORT), 8)

#powerPmacCreateVirtualAxis(<port_name>, <axis_index>, <coord_sys_index>, <axis_name>,<commaSeparatedMotorIndices)
# !!! COMMENTS AFTER 'powerPmacCreateVirtualAxis("$(PORT)",  9, 1, "X",1)' IS NOT ALLOWED !!!
powerPmacCreateVirtualAxis("$(PORT)", 9 , 1, "X",1,2,3,4)
powerPmacCreateVirtualAxis("$(PORT)", 10, 1, "Y",1,2,3,4)
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


