| 1 | == Application作成; Socket I/O == |
| 2 | KEITHLEY 2701を例に; EPICS R3.14.9での作業ログ(R3.14.12以降では不要の部分もあり) |
| 3 | |
| 4 | |
| 5 | 作業ディレクトリ作成 |
| 6 | {{{ |
| 7 | pfrproc2:~ % mkdir /users/obina/epics/app/Keith2701 |
| 8 | pfrproc2:~ % cd /users/obina/epics/app/Keith2701 |
| 9 | }}} |
| 10 | |
| 11 | テンプレートとしてiocを使用。 |
| 12 | {{{ |
| 13 | pfrproc2:Keith2701 % makeBaseApp.pl -t ioc keith2701 |
| 14 | |
| 15 | pfrproc2:Keith2701 % makeBaseApp.pl -i -t ioc keith2701 |
| 16 | The following target architectures are available in base: |
| 17 | linux-x86 |
| 18 | linux-x86_64 |
| 19 | What architecture do you want to use? linux-x86_64 |
| 20 | The following applications are available: |
| 21 | keith2701 |
| 22 | What application should the IOC(s) boot? |
| 23 | The default uses the IOC's name, even if not listed above. |
| 24 | Application name? |
| 25 | }}} |
| 26 | |
| 27 | {{{ |
| 28 | pfrproc2:Keith2701 % vi configure/RELEASE |
| 29 | |
| 30 | SNCSEQ=$(EPICS_BASE)/../modules/soft/seq/2.0.11 |
| 31 | ASYN=$(EPICS_BASE)/../modules/soft/asyn/4-11 |
| 32 | STREAM=$(EPICS_BASE)/../modules/soft/stream/2-5 |
| 33 | }}} |
| 34 | |
| 35 | この段階でエラーが出ないかどうか確認 |
| 36 | {{{ |
| 37 | pfrproc2:Keith2701 % make |
| 38 | }}} |
| 39 | 問題無ければ、いちど全て削除する |
| 40 | {{{ |
| 41 | pfrproc2:Keith2701 % make distclean |
| 42 | }}} |
| 43 | |
| 44 | srcディレクトリで作業 |
| 45 | {{{ |
| 46 | pfrproc2:Keith2701 % cd keith2701App/src/ |
| 47 | }}} |
| 48 | |
| 49 | |
| 50 | dbdファイル作成(Socket I/Oのみならば、Serial...とvxi11...の2行は不要だが、ついでに書いてしまう) |
| 51 | {{{ |
| 52 | pfrproc2:src % vi K2701.dbd |
| 53 | registrar(drvAsynIPPortRegisterCommands) |
| 54 | registrar(drvAsynSerialPortRegisterCommands) |
| 55 | registrar(vxi11RegisterCommands) |
| 56 | }}} |
| 57 | |
| 58 | Makefile編集; 順序に注意。stream.dbdより前にaai,aaoを追加すること。(R3.14.12では不要になる) |
| 59 | {{{ |
| 60 | pfrproc2:src % vi Makefile |
| 61 | |
| 62 | keith2701_DBD += base.dbd |
| 63 | keith2701_DBD += aaiRecord.dbd |
| 64 | keith2701_DBD += aaoRecord.dbd |
| 65 | keith2701_DBD += asyn.dbd |
| 66 | keith2701_DBD += stream.dbd |
| 67 | keith2701_DBD += K2701.dbd |
| 68 | |
| 69 | keith2701_LIBS += asyn |
| 70 | keith2701_LIBS += stream |
| 71 | |
| 72 | }}} |
| 73 | |
| 74 | プロトコルファイル作成 |
| 75 | {{{ |
| 76 | pfrproc2:src % cd ../Db/ |
| 77 | pfrproc2:Db % vi K2701.proto |
| 78 | |
| 79 | Terminator = CR LF; |
| 80 | # |
| 81 | getIDN { |
| 82 | out "*IDN?"; in "%39c"; |
| 83 | } |
| 84 | }}} |
| 85 | |
| 86 | Dbファイル作成 |
| 87 | {{{ |
| 88 | pfrproc2:Db % vi test.db |
| 89 | |
| 90 | record(stringin, "obina:idn") |
| 91 | { |
| 92 | field(DESC, "get IDN") |
| 93 | field(DTYP, "stream") |
| 94 | field(INP, "@K2701.proto getidn PS1") |
| 95 | } |
| 96 | |
| 97 | 同じディレクトリのMakefileに |
| 98 | DB += test.db |
| 99 | を追加 |
| 100 | }}} |
| 101 | |
| 102 | application top で makeをかける |
| 103 | {{{ |
| 104 | pfrproc2:Db % cd ../.. |
| 105 | pfrproc2:Keith2701 % make |
| 106 | }}} |
| 107 | |
| 108 | |
| 109 | startup script編集 |
| 110 | {{{ |
| 111 | pfrproc2:Keith2701 % cd iocBoot/iockeith2701 |
| 112 | pfrproc2:iockeith2701 % vi st.cmd |
| 113 | |
| 114 | dbLoadRecords("db/test.db") |
| 115 | epicsEnvSet("STREAM_PROTOCOL_PATH", ".:../../keith2701App/Db") |
| 116 | drvAsynIPPortConfigure ("PS1", "172.28.8.244:1394") |
| 117 | |
| 118 | pfrproc2:iockeith2701 % chmod +x st.cmd |
| 119 | pfrproc2:iockeith2701 % ./st.cmd |
| 120 | |
| 121 | |
| 122 | epics> dbpf obina:idn.PROC 1 |
| 123 | DBR_UCHAR: 1 0x1 |
| 124 | epics> 2012/05/09 00:58:24.682 PS1 obina:idn: 16 bytes surplus input "0912,A09 /A02 " |
| 125 | 2012/05/09 00:58:24.682 PS1 obina:idn: after 40 bytes "... INC.,MODEL 2701,111" |
| 126 | |
| 127 | stringinは40文字までだが、Keithleyが返してくる文字列が長いのでエラーが出るが気にしない。 |
| 128 | |
| 129 | eepics> dbpr obina:idn |
| 130 | ASG: DESC: get IDN DISA: 0 DISP: 0 |
| 131 | DISV: 1 NAME: obina:idn SEVR: INVALID STAT: CALC |
| 132 | SVAL: TPRO: 0 |
| 133 | VAL: KEITHLEY INSTRUMENTS INC.,MODEL 2701,11 |
| 134 | |
| 135 | }}} |