📄 halcmd.1
字号:
.\" Copyright (c) 2003 John Kasunich.\" (jmkasunich AT users DOT sourceforge DOT net).\".\" This is free documentation; you can redistribute it and/or.\" modify it under the terms of the GNU General Public License as.\" published by the Free Software Foundation; either version 2 of.\" the License, or (at your option) any later version..\".\" The GNU General Public License's references to "object code".\" and "executables" are to be interpreted as the output of any.\" document formatting or typesetting system, including.\" intermediate and printed output..\".\" This manual is distributed in the hope that it will be useful,.\" but WITHOUT ANY WARRANTY; without even the implied warranty of.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the.\" GNU General Public License for more details..\".\" You should have received a copy of the GNU General Public.\" License along with this manual; if not, write to the Free.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,.\" USA..\".\".\".de URL\\$2 \(laURL: \\$1 \(ra\\$3...if \n[.g] .mso www.tmac.TH HALCMD "1" "2003-12-18" "EMC Documentation" "HAL User's Manual".SH NAMEhalcmd \- manipulate the Enhanced Machine Controller HAL from the command line.SH SYNOPSIS.B halcmd[\fIOPTIONS\fR] [\fICOMMAND\fR [\fIARG\fR]].PP.B halrun [\fI-I\fR] [\fIHALCMD OPTIONS\fR].PP.B halrun [\fI-U\fR].SH DESCRIPTION\fBhalcmd\fR is used to manipulate the HAL (Hardware AbstractionLayer) from the command line. \fBhalcmd\fR can optionally readcommands from a file, allowing complex HAL configurations to beset up with a single command.\fBhalrun\fR is a convenience script which sets up the realtime environment,executes \fBhalcmd\fR with the given arguments, optionally runs an interactive\fBhalcmd -kf\fR if \fI-I\fR is given, then tears down the realtimeenvironment.If the \fBreadline\fR library is available when emc is compiled, then\fBhalcmd\fR offers commandline editing and completion when runninginteractively. Use the up arrow to recall previous commands, and press tab tocomplete the names of items such as pins and signals..SH OPTIONS.TP\fB-I\fRBefore tearing down the realtime environment, run an interactive halcmd.\fBhalrun\fR only. \fB-I\fR must precede all other commandline arguments..TP\fB\-f\fR [\fIfile\fR]Ignore commands on command line, take input from \fIfile\fRinstead. If \fIfile\fR is not specified, take input from\fIstdin\fR..TP\fB-i \fIinifile\fRUse variables from \fIinifile\fR for substitutions. See \fBSUBSTITUTION\fRbelow..TP\fB\-k\fRKeep going after failed command(s). The default is to stopand return failure if any command fails..TP\fB\-q\fRdisplay errors only (default).TP\fB\-Q\fRdisplay nothing, execute commands silently.TP\fB\-s\fRScript-friendly mode. In this mode, \fIshow\fR will not output titles for the itemsshown. Also, module names will be printed instead of ID codes in pin, param, and functlistings. Threads are printed on a single line, with the thread period, FP usage andname first, followed by all of the functions in the thread, in execution order. Signalsare printed on a single line, with the type, value, and signal name first, followed bya list of pins connected to the signal, showing both the direction and the pin name.No prompt will be printed if both \fB-s\fR and \fB-f\fR are specified..TP\fB-R\fRRelease the HAL mutex. This is useful for recovering when a HAL component has crashedwhile holding the HAL mutex..TP\fB-U\fRForcibly cause the realtime environment to exit. It releases the HAL mutex,requests that all HAL components unload, and stops the realtime system.\fBhalrun\fR only. \fB-U\fR must be the only commandline argument..TP\fB\-v\fRdisplay results of each command.TP\fB\-V\fRdisplay lots of debugging junk.TP\fB\-h\fR [\fIcommand\fR]display a help screen and exit, displays extended help on \fIcommand\fR if specified.SH COMMANDSCommands tell \fBhalcmd\fR what to do. Normally \fBhalcmd\fRreads a single command from the command line and executes it.If the '\fB-f\fR' option is used to read commands from a file,\fBhalcmd\fR reads each line of the file as a new command.Anything following '\fB#\fR' on a line is a comment..TP\fBloadrt\fR \fImodname\fR(\fIload\fR \fIr\fReal\fIt\fRime module) Loads a realtime HALmodule called \fImodname\fR. \fBhalcmd\fR looks for the modulein a directory specified at compile time.In systems with realtime, \fBhalcmd\fR calls the\fBemc_module_helper\fR to load realtime modules.\fBemc_module_helper\fR is a setuid program and is compiled witha whitelist of modules it is allowed to load. This is currentlyjust a list of \fBEMC\fR-related modules. The\fBemc_module_helper\fR execs insmod, so return codes and errormessages are those from insmod. Administrators who wish torestrict which users can load these \fBEMC\fR-related kernelmodules can do this by setting the permissions and group on\fBemc_module_helper\fR appropriately.In systems without realtime \fBhalcmd\fR calls the\fBrtapi_app\fR which creates the simulated realtime environmentif it did not yet exist, and then loads the requested componentwith a call to \fBdlopen(3)\fR..TP\fBunloadrt\fR \fImodname\fR(\fIunload\fR \fIr\fReal\fIt\fRime module) Unloads a realtime HALmodule called \fImodname\fR. If \fImodname\fR is "all", it willunload all currently loaded realtime HAL modules. \fBunloadrt\fRalso works by execing \fBemc_module_helper\fR or \fBrtapi_app\fR, just like\fBloadrt\fR..TP\fBloadusr\fR \fI[flags]\fR \fIunix-command\fR(\fIload\fR \fIUs\fRe\fIr\fRspace component) Executes the given\fIunix-command\fR, usually to load a userspace component.\fI[flags]\fR may be one or more of:.RS.IP \(bu 4\fB-W\fR to wait for the component to become ready. The componentis assumed to have the same name as the first argument of the command..IP \(bu 4\fB-Wn name\fR to wait for the component, which will have the givenname..IP \(bu 4\fB-w\fR to wait for the program to exit.IP \(bu 4\fB-i\fR to ignore the program return value (with -w).RE.TP\fBwaitusr\fR \fIname\fR(\fIwait\fR for \fIUs\fRe\fIr\fRspace component) Waits for userspace component \fIname\fR to disconnect from HAL (usually on exit).The component must already be loaded. Usefull near the end of aHAL file to wait until the user closes some user interface componentbefore cleaning up and exiting..TP\fBunloadusr\fR \fIcompname\fR(\fIunload\fR \fIUs\fRe\fIr\fRspace component) Unloads a userspacecomponent called \fIcompname\fR. If \fIcompname\fR is "all", it willunload all userspace components. \fBunloadusr\fRworks by sending SIGTERM to all userspace components..TP\fBunload\fR \fIcompname\fRUnloads a userspace component or realtime module. If \fIcompname\fR is "all",it will unload all userspace components and realtime modules..TP\fBnewsig\fR \fIsigname\fR \fItype\fR(\fInew\fR \fIsig\fRnal) Creates a new HAL signal called\fIsigname\fR that may later be used to connect two or moreHAL component pins. \fItype\fR is the data type of the newsignal, and must be one of "\fBbit\fR", "\fBs32\fR", "\fBu32\fR", or"\fBfloat\fR".Fails if a signal of the same name already exists..TP\fBdelsig\fR \fIsigname\fR(\fIdel\fRete \fIsig\fRnal) Deletes HAL signal \fIsigname\fR.Any pins currently linked to the signal will be unlinked.Fails if \fIsigname\fR does not exist..TP\fBsets\fR \fIsigname\fR \fIvalue\fR(\fIset\fR \fIs\fRignal) Sets the value of signal \fIsigname\fRto \fIvalue\fR. Fails if \fIsigname\fR does not exist, if italready has a writer, or if \fIvalue\fR is not a legal value.Legal values depend on the signals's type..TP\fBstype\fR \fIname\fR(\fIs\fRignal type\fR) Gets the type of signal\fIname\fR. Fails if \fIname\fR does not exist as a signal..TP\fBgets\fR \fIsigname\fR(\fIget\fR \fIs\fRignal) Gets the value of signal \fIsigname\fR. Failsif \fIsigname\fR does not exist..TP\fBlinkps\fR \fIpinname\fR [\fIarrow\fR] \fIsigname\fR(\fIlink\fR \fIp\fRin to \fIs\fRignal) Establishs a linkbetween a HAL component pin \fIpinname\fR and a HAL signal\fIsigname\fR. Any previous link to \fIpinname\fR will bebroken. \fIarrow\fR can be "\fB=>\fR", "\fB<=\fR", "\fB<=>\fR",or omitted. \fBhalcmd\fR ignores arrows, but they can be usefulin command files to document the direction of data flow. Arrowsshould not be used on the command line since the shell might tryto interpret them. Fails if either \fIpinname\fR or \fIsigname\fRdoes not exist, or if they are not the same type type..TP\fBlinksp\fR \fIsigname\fR [\fIarrow\fR] \fIpinname\fR(\fIlink\fR \fIs\fRignal to \fIp\fRin) Works like \fBlinkps\fRbut reverses the order of the arguments. \fBhalcmd\fR treatsboth link commands exactly the same. Use whichever you prefer..TP\fBlinkpp\fR \fIpinname1\fR [\fIarrow\fR] \fIpinname2\fR(OBSOLETE - use \fBnet\fR instead)(\fIlink\fR \fIp\fRin to \fIp\fRin) Shortcut for \fBlinkps\fRthat creates the signal (named like the first pin), then links them both to that signal. \fBhalcmd\fR treats this just as ifit were: \fBhalcmd\fR \fBnewsig\fR pinname1 \fBhalcmd\fR \fBlinksp\fR pinname1 pinname1 \fBhalcmd\fR \fBlinksp\fR pinname1 pinname2.TP\fBnet\fR \fIsigname\fR \fIpinname\fR \fI...\fRCreate \fIsignname\fR to match the type of \fIpinname\fR if it does not yetexist. Then, link \fIsigname\fR to each \fIpinname\fR in turn. Arrows maybe used as in \fBlinkps\fR..TP\fBunlinkp\fR \fIpinname\fR(\fIunlink\fR \fIp\fRin) Breaks any previous link to \fIpinname\fR.Fails if \fIpinname\fR does not exist..TP\fBsetp\fR \fIname\fR \fIvalue\fR(\fIset\fR \fIp\fRarameter or \fIp\fRin) Sets the value of parameter or pin\fIname\fR to \fIvalue\fR. Fails if \fIname\fR does not exist as a pin orparameter, if it is a parameter that is not writable, if it is a pin that is anoutput, if it is a pin that is already attached to a signal, or if \fIvalue\fRis not a legal value. Legal values depend on the type of the pin or parameter.If a pin and a parameter both exist with the given name, the parameter is actedon..TP\fIparamname\fR \fB=\fR \fIvalue\fR.TP\fIpinname\fR \fB=\fR \fIvalue\fRIdentical to \fBsetp\fR. This alternate form of the command maybe more convenient and readable when used in a file..TP\fBptype\fR \fIname\fR(\fIp\fRarameter or \fIp\fRin \fItype\fR) Gets the type of parameter orpin \fIname\fR. Fails if \fIname\fR does not exist as a pin orparameter. If a pin and a parameter both exist with the given name, theparameter is acted on..TP\fBgetp\fR \fIname\fR(\fIget\fR \fIp\fRarameter or \fIp\fRin) Gets the value of parameter orpin \fIname\fR. Fails if \fIname\fR does not exist as a pin orparameter. If a pin and a parameter both exist with the given name, theparameter is acted on..TP\fBaddf\fR \fIfunctname\fR \fIthreadname\fR(\fIadd\fR \fIf\fRunction) Adds function \fIfunctname\fR to realtimethread \fIthreadname\fR. \fIfunctname\fR will run after any functionsthat were previously added to the thread. Fails if either\fIfunctname\fR or \fIthreadname\fR does not exist, or if theyare incompatible..TP\fBdelf\fR \fIfunctname\fR \fIthreadname\fR(\fIdel\fRete \fIf\fRunction) Removes function \fIfunctname\fR fromrealtime thread \fIthreadname\fR. Fails if either \fIfunctname\fR or\fIthreadname\fR does not exist, or if \fIfunctname\fR is not currentlypart of \fIthreadname\fR..TP\fBstart\fRStarts execution of realtime threads. Each thread periodically callsall of the functions that were added to it with the \fBaddf\fR command,in the order in which they were added..TP\fBstop\fRStops execution of realtime threads. The threads will no longer calltheir functions..TP\fBshow\fR [\fIitem\fR]Prints HAL items to \fIstdout\fR in human readable format.\fIitem\fR can be one of "\fBcomp\fR" (components), "\fBpin\fR","\fBsig\fR" (signals), "\fBparam\fR" (parameters), "\fBfunct\fR"(functions), or "\fBthread\fR". The type "\fBall\fR" can be used to showmatching items of all the preceeding types. If \fIitem\fR is omitted,\fBshow\fR will print everything..TP\fBitem\fRThis is equivalent to \fBshow all [item]\fR..TP\fBsave\fR [\fIitem\fR]Prints HAL items to \fIstdout\fR in the form of HAL commands.These commands can be redirected to a file and later executedusing \fBhalcmd -f\fR to restore the saved configuration.\fIitem\fR can be one of the following: "\fBcomp\fR" generatesa \fBloadrt\fR command for realtime component. "\fBsig\fR" generates a \fBnewsig\fR command for each signal, and "\fBsigu\fR" generates a\fBnewsig\fR command for each unlinked signal (for use with \fBnetl\fR and\fBnetla\fR). "\fBlink\fR" and "\fBlinka\fR" both generate \fBlinkps\fRcommands for each link. (\fBlinka\fR includes arrows, while \fBlink\fR doesnot.) "\fBnet\fR" and "\fBneta\fR" both generate one \fBnewsig\fR command foreach signal, followed by \fBlinksp\fR commands for each pin linked to thatsignal. (\fBneta\fR includes arrows.) "\fBnetl\fR" generates one \fBnet\fRcommand for each linked signal, and "\fBnetla\fR" generates a similar commandusing arrows. "\fBparam\fR" generates one \fBsetp\fR command for eachparameter. "\fBthread\fR" generates one \fBaddf\fR command for each functionin each realtime thread. If \fIitem\fR is omitted, \fBsave\fR does theequivalent of \fBcomp\fR, \fBsigu\fR, \fBlink\fR, \fBparam\fR, and \fBthread\fR..TP\fBsource\fR \fIfilename.hal\fRExecute the commands from \fIfilename.hal\fR..SH SUBSTITUTIONAfter a command is read but before it is executed, several types of variablesubstitution take place..SS Environment VariablesEnvironment variables have the following formats:.IP\fB$ENVVAR\fR followed by end-of-line or whitespace.IP\fB$(ENVVAR)\fR.SS Inifile VariablesInifile variables are available only when an inifile was specified with thehalcmd \fB-i\fR flag. They have the following formats:.IP\fB[SECTION]VAR\fR followed by end-of-line or whitespace.IP\fB[SECTION](VAR)\fR.SH EXAMPLES.SH "SEE ALSO".SH HISTORY.SH BUGSNone known at this time..SH AUTHOROriginal version by John Kasunich, as part of the Enhanced MachineController (EMC) project. Now includes major contributions by severalmembers of the project..SH REPORTING BUGSReport bugs to the.URL http://sf.net/tracker/?group_id=6744&atid=106744 "emc bug tracker" ..SH COPYRIGHTCopyright \(co 2003 John Kasunich..brThis is free software; see the source for copying conditions. There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -