source: rtems-docs/shell/general_commands.rst

Last change on this file was 171bbe0, checked in by Christian Mauderer <christian.mauderer@…>, on 12/01/20 at 09:58:51

shell: Document i2c and spi commands.

  • Property mode set to 100644
File size: 36.0 KB
Line 
1.. SPDX-License-Identifier: CC-BY-SA-4.0
2
3.. Copyright (C) 1988, 2008 On-Line Applications Research Corporation (OAR)
4
5General Commands
6****************
7
8Introduction
9============
10
11The RTEMS shell has the following general commands:
12
13- help_ - Print command help
14
15- alias_ - Add alias for an existing command
16
17- cmdls_ - List commands
18
19- cmdchown_ - Change user or owner of commands
20
21- cmdchmod_ - Change mode of commands
22
23- date_ - Print or set current date and time
24
25- echo_ - Produce message in a shell script
26
27- sleep_ - Delay for a specified amount of time
28
29- id_ - show uid gid euid and egid
30
31- tty_ - show ttyname
32
33- whoami_ - print effective user id
34
35- getenv_ - print environment variable
36
37- setenv_ - set environment variable
38
39- unsetenv_ - unset environment variable
40
41- time_ - time command execution
42
43- logoff_ - logoff from the system
44
45- rtc_ - RTC driver configuration
46
47- i2cdetect_ - detect I2C devices
48
49- i2cget_ - get data from an EEPROM like I2C device
50
51- i2cset_ - write data to an EEPROM like I2C device
52
53- spi_ - read and write simple data to an SPI bus
54
55- exit_ - alias for logoff command
56
57Commands
58========
59
60This section details the General Commands available.  A subsection is dedicated
61to each of the commands and describes the behavior and configuration of that
62command as well as providing an example usage.
63
64.. raw:: latex
65
66   \clearpage
67
68.. _help:
69
70help - Print command help
71-------------------------
72.. index:: help
73
74SYNOPSYS:
75    .. code-block:: shell
76
77        help misc
78
79DESCRIPTION:
80    This command prints the command help. Help without arguments prints a list
81    of topics and help with a topic prints the help for that topic.
82
83EXIT STATUS:
84    This command returns 0.
85
86NOTES:
87    The help print will break the output up based on the environment variable
88    SHELL_LINES. If this environment variable is not set the default is 16
89    lines. If set the number of lines is set to that the value. If the shell
90    lines is set 0 there will be no break.
91
92EXAMPLES:
93    The following is an example of how to use ``alias``:
94
95    .. code-block:: shell
96
97        SHLL [/] $ help
98        help: ('r' repeat last cmd - 'e' edit last cmd)
99        TOPIC? The topics are
100        mem, misc, files, help, rtems, network, monitor
101        SHLL [/] $ help misc
102        help: list for the topic 'misc'
103        alias        - alias old new
104        time         - time command [arguments...]
105        joel         - joel [args] SCRIPT
106        date         - date [YYYY-MM-DD HH:MM:SS]
107        echo         - echo [args]
108        sleep        - sleep seconds [nanoseconds]
109        id           - show uid, gid, euid, and egid
110        tty          - show ttyname
111        whoami       - show current user
112        logoff       - logoff from the system
113        setenv       - setenv [var] [string]
114        getenv       - getenv [var]
115        unsetenv     - unsetenv [var]
116        umask        - umask [new_umask]
117        Press any key to continue...
118        rtc          - real time clock read and set
119        SHLL [/] $ setenv SHELL_ENV 0
120        SHLL [/] $ help misc
121        help: list for the topic 'misc'
122        alias        - alias old new
123        time         - time command [arguments...]
124        joel         - joel [args] SCRIPT
125        date         - date [YYYY-MM-DD HH:MM:SS]
126        echo         - echo [args]
127        sleep        - sleep seconds [nanoseconds]
128        id           - show uid, gid, euid, and egid
129        tty          - show ttyname
130        whoami       - show current user
131        logoff       - logoff from the system
132        setenv       - setenv [var] [string]
133        getenv       - getenv [var]
134        unsetenv     - unsetenv [var]
135        umask        - umask [new_umask]
136        rtc          - real time clock read and set
137
138CONFIGURATION:
139    This command has no configuration.
140
141.. raw:: latex
142
143   \clearpage
144
145.. _alias:
146
147alias - add alias for an existing command
148-----------------------------------------
149.. index:: alias
150
151SYNOPSYS:
152    .. code-block:: shell
153
154        alias oldCommand newCommand
155
156DESCRIPTION:
157    This command adds an alternate name for an existing command to the command
158    set.
159
160EXIT STATUS:
161    This command returns 0 on success and non-zero if an error is encountered.
162
163NOTES:
164    None.
165
166EXAMPLES:
167    The following is an example of how to use ``alias``:
168
169    .. code-block:: shell
170
171        SHLL [/] $ me
172        shell:me command not found
173        SHLL [/] $ alias whoami me
174        SHLL [/] $ me
175        rtems
176        SHLL [/] $ whoami
177        rtems
178
179.. index:: CONFIGURE_SHELL_NO_COMMAND_ALIAS
180.. index:: CONFIGURE_SHELL_COMMAND_ALIAS
181
182CONFIGURATION:
183    This command is included in the default shell command set.  When building a
184    custom command set, define ``CONFIGURE_SHELL_COMMAND_ALIAS`` to have this
185    command included.
186
187    This command can be excluded from the shell command set by defining
188    ``CONFIGURE_SHELL_NO_COMMAND_ALIAS`` when all shell commands have been
189    configured.
190
191.. index:: rtems_shell_rtems_main_alias
192
193PROGRAMMING INFORMATION:
194    The ``alias`` is implemented by a C language function which has the
195    following prototype:
196
197    .. code-block:: c
198
199        int rtems_shell_rtems_main_alias(
200            int    argc,
201            char **argv
202        );
203
204    The configuration structure for the ``alias`` has the following prototype:
205
206    .. code-block:: c
207
208        extern rtems_shell_cmd_t rtems_shell_ALIAS_Command;
209
210.. raw:: latex
211
212   \clearpage
213
214.. _cmdls:
215
216cmdls - List commands
217---------------------
218.. index:: cmdls
219
220SYNOPSYS:
221    .. code-block:: shell
222
223        cmdls COMMAND...
224
225DESCRIPTION:
226    This command lists the visible commands of the command set.
227
228EXIT STATUS:
229    This command returns 0 on success and non-zero if an error is encountered.
230
231NOTES:
232    The current user must have read permission to list a command.
233
234EXAMPLES:
235    The following is an example of how to use ``cmdls``:
236
237    .. code-block:: shell
238
239        SHLL [/] # cmdls help shutdown
240        r-xr-xr-x     0     0 help
241        r-x------     0     0 shutdown
242
243.. index:: CONFIGURE_SHELL_NO_COMMAND_CMDLS
244.. index:: CONFIGURE_SHELL_COMMAND_CMDLS
245
246CONFIGURATION:
247    This command is included in the default shell command set.  When building a
248    custom command set, define ``CONFIGURE_SHELL_COMMAND_CMDLS`` to have this
249    command included.
250
251    This command can be excluded from the shell command set by defining
252    ``CONFIGURE_SHELL_NO_COMMAND_CMDLS`` when all shell commands have been
253    configured.
254
255PROGRAMMING INFORMATION:
256    The configuration structure for the ``cmdls`` has the following prototype:
257
258    .. code-block:: c
259
260        extern rtems_shell_cmd_t rtems_shell_CMDLS_Command;
261
262.. raw:: latex
263
264   \clearpage
265
266.. _cmdchown:
267
268cmdchown - Change user or owner of commands
269-------------------------------------------
270.. index:: cmdchown
271
272SYNOPSYS:
273    .. code-block:: shell
274
275        cmdchown [OWNER][:[GROUP]] COMMAND...
276
277DESCRIPTION:
278    This command changes the user or owner of a command.
279
280EXIT STATUS:
281    This command returns 0 on success and non-zero if an error is encountered.
282
283NOTES:
284    The current user must have an UID of zero or be the command owner to change
285    the owner or group.
286
287EXAMPLES:
288    The following is an example of how to use ``cmdchown``:
289
290    .. code-block:: shell
291
292        [/] # cmdls help
293        r-xr-xr-x     0     0 help
294        [/] # cmdchown 1:1 help
295        [/] # cmdls help
296        r--r--r--     1     1 help
297
298.. index:: CONFIGURE_SHELL_NO_COMMAND_CMDCHOWN
299.. index:: CONFIGURE_SHELL_COMMAND_CMDCHOWN
300
301CONFIGURATION:
302    This command is included in the default shell command set.  When building a
303    custom command set, define ``CONFIGURE_SHELL_COMMAND_CMDCHOWN`` to have
304    this command included.
305
306    This command can be excluded from the shell command set by defining
307    ``CONFIGURE_SHELL_NO_COMMAND_CMDCHOWN`` when all shell commands have been
308    configured.
309
310PROGRAMMING INFORMATION:
311    The configuration structure for the ``cmdchown`` has the following
312    prototype:
313
314    .. code-block:: c
315
316        extern rtems_shell_cmd_t rtems_shell_CMDCHOWN_Command;
317
318.. raw:: latex
319
320   \clearpage
321
322.. _cmdchmod:
323
324cmdchmod - Change mode of commands
325----------------------------------
326.. index:: cmdchmod
327
328SYNOPSYS:
329    .. code-block:: shell
330
331        cmdchmod OCTAL-MODE COMMAND...
332
333DESCRIPTION:
334    This command changes the mode of a command.
335
336EXIT STATUS:
337    This command returns 0 on success and non-zero if an error is encountered.
338
339NOTES:
340    The current user must have an UID of zero or be the command owner to change
341    the mode.
342
343EXAMPLES:
344    The following is an example of how to use ``cmdchmod``:
345
346    .. code-block:: shell
347
348        [/] # cmdls help
349        r-xr-xr-x     0     0 help
350        [/] # cmdchmod 544 help
351        [/] # cmdls help
352        r-xr--r--     0     0 help
353
354.. index:: CONFIGURE_SHELL_NO_COMMAND_CMDCHMOD
355.. index:: CONFIGURE_SHELL_COMMAND_CMDCHMOD
356
357CONFIGURATION:
358    This command is included in the default shell command set.  When building a
359    custom command set, define ``CONFIGURE_SHELL_COMMAND_CMDCHMOD`` to have
360    this command included.
361
362    This command can be excluded from the shell command set by defining
363    ``CONFIGURE_SHELL_NO_COMMAND_CMDCHMOD`` when all shell commands have been
364    configured.
365
366PROGRAMMING INFORMATION:
367    The configuration structure for the ``cmdchmod`` has the following
368    prototype:
369
370    .. code-block:: c
371
372        extern rtems_shell_cmd_t rtems_shell_CMDCHMOD_Command;
373
374.. raw:: latex
375
376   \clearpage
377
378.. _date:
379
380date - print or set current date and time
381-----------------------------------------
382.. index:: date
383
384SYNOPSYS:
385    .. code-block:: shell
386
387        date
388        date DATE TIME
389
390DESCRIPTION:
391    This command operates one of two modes.  When invoked with no arguments, it
392    prints the current date and time.  When invoked with both ``date`` and
393    ``time`` arguments, it sets the current time.
394
395    The ``date`` is specified in ``YYYY-MM-DD`` format.
396    The ``time`` is specified in ``HH:MM:SS`` format.
397
398EXIT STATUS:
399    This command returns 0 on success and non-zero if an error is encountered.
400
401NOTES:
402    None.
403
404EXAMPLES:
405    The following is an example of how to use ``date``:
406
407    .. code-block:: shell
408
409        SHLL [/] $ date
410        Fri Jan  1 00:00:09 1988
411        SHLL [/] $ date 2008-02-29 06:45:32
412        SHLL [/] $ date
413        Fri Feb 29 06:45:35 2008
414
415.. index:: CONFIGURE_SHELL_NO_COMMAND_DATE
416.. index:: CONFIGURE_SHELL_COMMAND_DATE
417
418CONFIGURATION:
419    This command is included in the default shell command set.  When building a
420    custom command set, define ``CONFIGURE_SHELL_COMMAND_DATE`` to have this
421    command included.
422
423    This command can be excluded from the shell command set by defining
424    ``CONFIGURE_SHELL_NO_COMMAND_DATE`` when all shell commands have been
425    configured.
426
427.. index:: rtems_shell_rtems_main_date
428
429PROGRAMMING INFORMATION:
430    The ``date`` is implemented by a C language function which has the
431    following prototype:
432
433    .. code-block:: c
434
435        int rtems_shell_rtems_main_date(
436            int    argc,
437            char **argv
438        );
439
440    The configuration structure for the ``date`` has the following prototype:
441
442    .. code-block:: c
443
444        extern rtems_shell_cmd_t rtems_shell_DATE_Command;
445
446.. raw:: latex
447
448   \clearpage
449
450.. _echo:
451
452echo - produce message in a shell script
453----------------------------------------
454.. index:: echo
455
456SYNOPSYS:
457    .. code-block:: shell
458
459        echo [-n | -e] args ...
460
461DESCRIPTION:
462    Echo prints its arguments on the standard output, separated by spaces.
463    Unless the *-n* option is present, a newline is output following the
464    arguments.  The *-e* option causes echo to treat the escape sequences
465    specially, as described in the following paragraph.  The *-e* option is the
466    default, and is provided solely for compatibility with other systems.  Only
467    one of the options *-n* and *-e* may be given.
468
469    If any of the following sequences of characters is encountered during
470    output, the sequence is not output.  Instead, the specified action is
471    performed:
472
473    *\b*
474        A backspace character is output.
475
476    *\c*
477        Subsequent output is suppressed.  This is normally used at the end of
478        the last argument to suppress the trailing newline that echo would
479        otherwise output.
480
481    *\f*
482        Output a form feed.
483
484    *\n*
485        Output a newline character.
486
487    *\r*
488        Output a carriage return.
489
490    *\t*
491        Output a (horizontal) tab character.
492
493    *\v*
494        Output a vertical tab.
495
496    *\0digits*
497        Output the character whose value is given by zero to three digits.  If
498        there are zero digits, a nul character is output.
499
500    *\\*
501        Output a backslash.
502
503EXIT STATUS:
504    This command returns 0 on success and non-zero if an error is encountered.
505
506NOTES:
507    The octal character escape mechanism (\0digits) differs from the C language
508    mechanism.
509
510    There is no way to force ``echo`` to treat its arguments literally, rather
511    than interpreting them as options and escape sequences.
512
513EXAMPLES:
514    The following is an example of how to use ``echo``:
515
516    .. code-block:: shell
517
518        SHLL [/] $ echo a b c
519        a b c
520        SHLL [/] $ echo
521
522.. index:: CONFIGURE_SHELL_NO_COMMAND_ECHO
523.. index:: CONFIGURE_SHELL_COMMAND_ECHO
524
525CONFIGURATION:
526    This command is included in the default shell command set.  When building a
527    custom command set, define ``CONFIGURE_SHELL_COMMAND_ECHO`` to have this
528    command included.
529
530    This command can be excluded from the shell command set by defining
531    ``CONFIGURE_SHELL_NO_COMMAND_ECHO`` when all shell commands have been
532    configured.
533
534.. index:: rtems_shell_rtems_main_echo
535
536PROGRAMMING INFORMATION:
537    The ``echo`` is implemented by a C language function which has the
538    following prototype:
539
540    .. code-block:: c
541
542        int rtems_shell_rtems_main_echo(
543            int    argc,
544            char **argv
545        );
546
547    The configuration structure for the ``echo`` has the following prototype:
548
549    .. code-block:: c
550
551        extern rtems_shell_cmd_t rtems_shell_ECHO_Command;
552
553ORIGIN:
554    The implementation and portions of the documentation for this command are
555    from NetBSD 4.0.
556
557.. raw:: latex
558
559   \clearpage
560
561.. _sleep:
562
563sleep - delay for a specified amount of time
564--------------------------------------------
565.. index:: sleep
566
567SYNOPSYS:
568    .. code-block:: shell
569
570        sleep seconds
571        sleep seconds nanoseconds
572
573DESCRIPTION:
574    This command causes the task executing the shell to block for the specified
575    number of ``seconds`` and ``nanoseconds``.
576
577EXIT STATUS:
578    This command returns 0 on success and non-zero if an error is encountered.
579
580NOTES:
581    This command is implemented using the ``nanosleep()`` method.
582
583    The command line interface is similar to the ``sleep`` command found on
584    POSIX systems but the addition of the ``nanoseconds`` parameter allows fine
585    grained delays in shell scripts without adding another command such as
586    ``usleep``.
587
588EXAMPLES:
589    The following is an example of how to use ``sleep``:
590
591    .. code-block:: shell
592
593        SHLL [/] $ sleep 10
594        SHLL [/] $ sleep 0 5000000
595
596    It is not clear from the above but there is a ten second pause after
597    executing the first command before the prompt is printed.  The second
598    command completes very quickly from a human perspective and there is no
599    noticeable delay in the prompt being printed.
600
601.. index:: CONFIGURE_SHELL_NO_COMMAND_SLEEP
602.. index:: CONFIGURE_SHELL_COMMAND_SLEEP
603
604CONFIGURATION:
605    This command is included in the default shell command set.  When building a
606    custom command set, define ``CONFIGURE_SHELL_COMMAND_SLEEP`` to have this
607    command included.
608
609    This command can be excluded from the shell command set by defining
610    ``CONFIGURE_SHELL_NO_COMMAND_SLEEP`` when all shell commands have been
611    configured.
612
613.. index:: rtems_shell_rtems_main_sleep
614
615PROGRAMMING INFORMATION:
616    The ``sleep`` is implemented by a C language function which has the
617    following prototype:
618
619    .. code-block:: c
620
621        int rtems_shell_rtems_main_sleep(
622            int    argc,
623            char **argv
624        );
625
626    The configuration structure for the ``sleep`` has the following prototype:
627
628    .. code-block:: c
629
630        extern rtems_shell_cmd_t rtems_shell_SLEEP_Command;
631
632.. raw:: latex
633
634   \clearpage
635
636.. _id:
637
638id - show uid gid euid and egid
639-------------------------------
640.. index:: id
641
642SYNOPSYS:
643    .. code-block:: shell
644
645        id
646
647DESCRIPTION:
648    This command prints the user identity.  This includes the user id (uid),
649    group id (gid), effective user id (euid), and effective group id (egid).
650
651EXIT STATUS:
652    This command returns 0 on success and non-zero if an error is encountered.
653
654NOTES:
655    Remember there is only one POSIX process in a single processor RTEMS
656    application. Each thread may have its own user identity and that identity
657    is used by the filesystem to enforce permissions.
658
659EXAMPLES:
660    The first example of the ``id`` command is from a session logged
661    in as the normal user ``rtems``:
662
663    .. code-block:: shell
664
665        SHLL [/] # id
666        uid=1(rtems),gid=1(rtems),euid=1(rtems),egid=1(rtems)
667
668    The second example of the ``id`` command is from a session logged in as the
669    ``root`` user:
670
671    .. code-block:: shell
672
673        SHLL [/] # id
674        uid=0(root),gid=0(root),euid=0(root),egid=0(root)
675
676.. index:: CONFIGURE_SHELL_NO_COMMAND_ID
677.. index:: CONFIGURE_SHELL_COMMAND_ID
678
679CONFIGURATION:
680    This command is included in the default shell command set.  When building a
681    custom command set, define ``CONFIGURE_SHELL_COMMAND_ID`` to have this
682    command included.
683
684    This command can be excluded from the shell command set by defining
685    ``CONFIGURE_SHELL_NO_COMMAND_ID`` when all shell commands have been configured.
686
687.. index:: rtems_shell_rtems_main_id
688
689PROGRAMMING INFORMATION:
690    The ``id`` is implemented by a C language function which has the following
691    prototype:
692
693    .. code-block:: c
694
695        int rtems_shell_rtems_main_id(
696            int    argc,
697            char **argv
698        );
699
700    The configuration structure for the ``id`` has the following prototype:
701
702    .. code-block:: c
703
704        extern rtems_shell_cmd_t rtems_shell_ID_Command;
705
706.. raw:: latex
707
708   \clearpage
709
710.. _tty:
711
712tty - show ttyname
713------------------
714.. index:: tty
715
716SYNOPSYS:
717    .. code-block:: shell
718
719        tty
720
721DESCRIPTION:
722    This command prints the file name of the device connected to standard
723    input.
724
725EXIT STATUS:
726    This command returns 0 on success and non-zero if an error is encountered.
727
728NOTES:
729    NONE
730
731EXAMPLES:
732    The following is an example of how to use ``tty``:
733
734    .. code-block:: shell
735
736        SHLL [/] $ tty
737        /dev/console
738
739.. index:: CONFIGURE_SHELL_NO_COMMAND_TTY
740.. index:: CONFIGURE_SHELL_COMMAND_TTY
741
742CONFIGURATION:
743    This command is included in the default shell command set.  When building a
744    custom command set, define ``CONFIGURE_SHELL_COMMAND_TTY`` to have this
745    command included.
746
747    This command can be excluded from the shell command set by defining
748    ``CONFIGURE_SHELL_NO_COMMAND_TTY`` when all shell commands have been
749    configured.
750
751.. index:: rtems_shell_rtems_main_tty
752
753PROGRAMMING INFORMATION:
754    The ``tty`` is implemented by a C language function which has the following
755    prototype:
756
757    .. code-block:: c
758
759        int rtems_shell_rtems_main_tty(
760            int    argc,
761            char **argv
762        );
763
764    The configuration structure for the ``tty`` has the following prototype:
765
766    .. code-block:: c
767
768        extern rtems_shell_cmd_t rtems_shell_TTY_Command;
769
770.. raw:: latex
771
772   \clearpage
773
774.. _whoami:
775
776whoami - print effective user id
777--------------------------------
778.. index:: whoami
779
780SYNOPSYS:
781    .. code-block:: shell
782
783        whoami
784
785DESCRIPTION:
786    This command displays the user name associated with the current effective
787    user
788    id.
789
790EXIT STATUS:
791    This command always succeeds.
792
793NOTES:
794    None.
795
796EXAMPLES:
797    The following is an example of how to use ``whoami``:
798
799    .. code-block:: shell
800
801        SHLL [/] $ whoami
802        rtems
803
804.. index:: CONFIGURE_SHELL_NO_COMMAND_WHOAMI
805.. index:: CONFIGURE_SHELL_COMMAND_WHOAMI
806
807CONFIGURATION:
808    This command is included in the default shell command set.  When building a
809    custom command set, define ``CONFIGURE_SHELL_COMMAND_WHOAMI`` to have this
810    command included.
811
812    This command can be excluded from the shell command set by defining
813    ``CONFIGURE_SHELL_NO_COMMAND_WHOAMI`` when all shell commands have been
814    configured.
815
816.. index:: rtems_shell_rtems_main_whoami
817
818PROGRAMMING INFORMATION:
819    The ``whoami`` is implemented by a C language function which has the
820    following prototype:
821
822    .. code-block:: c
823
824        int rtems_shell_rtems_main_whoami(
825            int    argc,
826            char **argv
827        );
828
829    The configuration structure for the ``whoami`` has the following prototype:
830
831    .. code-block:: c
832
833        extern rtems_shell_cmd_t rtems_shell_WHOAMI_Command;
834
835.. raw:: latex
836
837   \clearpage
838
839.. _getenv:
840
841getenv - print environment variable
842-----------------------------------
843.. index:: getenv
844
845SYNOPSYS:
846    .. code-block:: shell
847
848        getenv variable
849
850DESCRIPTION:
851    This command is used to display the value of a ``variable`` in the set of
852    environment variables.
853
854EXIT STATUS:
855    This command will return 1 and print a diagnostic message if a failure
856    occurs.
857
858NOTES:
859    The entire RTEMS application shares a single set of environment variables.
860
861EXAMPLES:
862    The following is an example of how to use ``getenv``:
863
864    .. code-block:: shell
865
866        SHLL [/] $ getenv BASEPATH
867        /mnt/hda1
868
869.. index:: CONFIGURE_SHELL_NO_COMMAND_GETENV
870.. index:: CONFIGURE_SHELL_COMMAND_GETENV
871
872CONFIGURATION:
873    This command is included in the default shell command set.  When building a
874    custom command set, define ``CONFIGURE_SHELL_COMMAND_GETENV`` to have this
875    command included.
876
877    This command can be excluded from the shell command set by defining
878    ``CONFIGURE_SHELL_NO_COMMAND_GETENV`` when all shell commands have been
879    configured.
880
881.. index:: rtems_shell_rtems_main_getenv
882
883PROGRAMMING INFORMATION:
884    The ``getenv`` is implemented by a C language function which has the
885    following prototype:
886
887    .. code-block:: c
888
889        int rtems_shell_rtems_main_getenv(
890            int    argc,
891            char **argv
892        );
893
894    The configuration structure for the ``getenv`` has the following prototype:
895
896    .. code-block:: c
897
898        extern rtems_shell_cmd_t rtems_shell_GETENV_Command;
899
900.. raw:: latex
901
902   \clearpage
903
904.. _setenv:
905
906setenv - set environment variable
907---------------------------------
908.. index:: setenv
909
910SYNOPSYS:
911    .. code-block:: shell
912
913        setenv variable [value]
914
915DESCRIPTION:
916    This command is used to add a new ``variable`` to the set of environment
917    variables or to modify the variable of an already existing ``variable``.
918    If the ``value`` is not provided, the ``variable`` will be set to the empty
919    string.
920
921EXIT STATUS:
922    This command will return 1 and print a diagnostic message if a failure
923    occurs.
924
925NOTES:
926    The entire RTEMS application shares a single set of environment variables.
927
928EXAMPLES:
929    The following is an example of how to use ``setenv``:
930
931    .. code-block:: shell
932
933        SHLL [/] $ setenv BASEPATH /mnt/hda1
934
935.. index:: CONFIGURE_SHELL_NO_COMMAND_SETENV
936.. index:: CONFIGURE_SHELL_COMMAND_SETENV
937
938CONFIGURATION:
939    This command is included in the default shell command set.  When building a
940    custom command set, define ``CONFIGURE_SHELL_COMMAND_SETENV`` to have this
941    command included.
942
943    This command can be excluded from the shell command set by defining
944    ``CONFIGURE_SHELL_NO_COMMAND_SETENV`` when all shell commands have been
945    configured.
946
947.. index:: rtems_shell_rtems_main_setenv
948
949PROGRAMMING INFORMATION:
950    The ``setenv`` is implemented by a C language function which has the
951    following prototype:
952
953    .. code-block:: c
954
955        int rtems_shell_rtems_main_setenv(
956            int    argc,
957            char **argv
958        );
959
960    The configuration structure for the ``setenv`` has the following prototype:
961
962    .. code-block:: c
963
964        extern rtems_shell_cmd_t rtems_shell_SETENV_Command;
965
966.. raw:: latex
967
968   \clearpage
969
970.. _unsetenv:
971
972unsetenv - unset environment variable
973-------------------------------------
974.. index:: unsetenv
975
976SYNOPSYS:
977    .. code-block:: shell
978
979        unsetenv variable
980
981DESCRIPTION:
982    This command is remove to a ``variable`` from the set of environment
983    variables.
984
985EXIT STATUS:
986    This command will return 1 and print a diagnostic message if a failure
987    occurs.
988
989NOTES:
990    The entire RTEMS application shares a single set of environment variables.
991
992EXAMPLES:
993    The following is an example of how to use ``unsetenv``:
994
995    .. code-block:: shell
996
997        SHLL [/] $ unsetenv BASEPATH
998
999.. index:: CONFIGURE_SHELL_NO_COMMAND_UNSETENV
1000.. index:: CONFIGURE_SHELL_COMMAND_UNSETENV
1001
1002CONFIGURATION:
1003    This command is included in the default shell command set.  When building a
1004    custom command set, define ``CONFIGURE_SHELL_COMMAND_UNSETENV`` to have
1005    this command included.
1006
1007    This command can be excluded from the shell command set by defining
1008    ``CONFIGURE_SHELL_NO_COMMAND_UNSETENV`` when all shell commands have been
1009    configured.
1010
1011.. index:: rtems_shell_rtems_main_unsetenv
1012
1013PROGRAMMING INFORMATION:
1014    The ``unsetenv`` is implemented by a C language function which has the
1015    following prototype:
1016
1017    .. code-block:: c
1018
1019        int rtems_shell_rtems_main_unsetenv(
1020            int    argc,
1021            char **argv
1022        );
1023
1024    The configuration structure for the ``unsetenv`` has the following prototype:
1025
1026    .. code-block:: c
1027
1028        extern rtems_shell_cmd_t rtems_shell_UNSETENV_Command;
1029
1030.. raw:: latex
1031
1032   \clearpage
1033
1034.. _time:
1035
1036time - time command execution
1037-----------------------------
1038.. index:: time
1039
1040SYNOPSYS:
1041    .. code-block:: shell
1042
1043        time command [argument ...]
1044
1045DESCRIPTION:
1046    The time command executes and times a command.  After the command finishes,
1047    time writes the total time elapsed.  Times are reported in seconds.
1048
1049EXIT STATUS:
1050    This command returns 0 on success and non-zero if an error is encountered.
1051
1052NOTES:
1053    None.
1054
1055EXAMPLES:
1056    The following is an example of how to use ``time``:
1057
1058    .. code-block:: shell
1059
1060        SHLL [/] $ time cp -r /nfs/directory /c
1061
1062.. index:: CONFIGURE_SHELL_NO_COMMAND_TIME
1063.. index:: CONFIGURE_SHELL_COMMAND_TIME
1064
1065CONFIGURATION:
1066    This command is included in the default shell command set.  When building a
1067    custom command set, define ``CONFIGURE_SHELL_COMMAND_TIME`` to have this
1068    command included.
1069
1070    This command can be excluded from the shell command set by defining
1071    ``CONFIGURE_SHELL_NO_COMMAND_TIME`` when all shell commands have been
1072    configured.
1073
1074.. index:: rtems_shell_rtems_main_time
1075
1076PROGRAMMING INFORMATION:
1077    The ``time`` is implemented by a C language function which has the
1078    following prototype:
1079
1080    .. code-block:: c
1081
1082        int rtems_shell_rtems_main_time(
1083            int    argc,
1084            char **argv
1085        );
1086
1087    The configuration structure for the ``time`` has the following prototype:
1088
1089    .. code-block:: c
1090
1091        extern rtems_shell_cmd_t rtems_shell_TIME_Command;
1092
1093.. raw:: latex
1094
1095   \clearpage
1096
1097.. _logoff:
1098
1099logoff - logoff from the system
1100-------------------------------
1101.. index:: logoff
1102
1103SYNOPSYS:
1104    .. code-block:: shell
1105
1106        logoff
1107
1108DESCRIPTION:
1109    This command logs the user out of the shell.
1110
1111EXIT STATUS:
1112    This command does not return.
1113
1114NOTES:
1115    The system behavior when the shell is exited depends upon how the shell was
1116    initiated.  The typical behavior is that a login prompt will be displayed
1117    for the next login attempt or that the connection will be dropped by the
1118    RTEMS system.
1119
1120EXAMPLES:
1121    The following is an example of how to use ``logoff``:
1122
1123    .. code-block:: shell
1124
1125        SHLL [/] $ logoff
1126        logoff from the system...
1127
1128.. index:: CONFIGURE_SHELL_NO_COMMAND_LOGOFF
1129.. index:: CONFIGURE_SHELL_COMMAND_LOGOFF
1130
1131CONFIGURATION:
1132    This command is included in the default shell command set.  When building a
1133    custom command set, define ``CONFIGURE_SHELL_COMMAND_LOGOFF`` to have this
1134    command included.
1135
1136    This command can be excluded from the shell command set by defining
1137    ``CONFIGURE_SHELL_NO_COMMAND_LOGOFF`` when all shell commands have been
1138    configured.
1139
1140.. index:: rtems_shell_rtems_main_logoff
1141
1142PROGRAMMING INFORMATION:
1143    The ``logoff`` is implemented by a C language function which has the
1144    following prototype:
1145
1146    .. code-block:: c
1147
1148        int rtems_shell_rtems_main_logoff(
1149            int    argc,
1150            char **argv
1151        );
1152
1153    The configuration structure for the ``logoff`` has the following prototype:
1154
1155    .. code-block:: c
1156
1157        extern rtems_shell_cmd_t rtems_shell_LOGOFF_Command;
1158
1159.. raw:: latex
1160
1161   \clearpage
1162
1163.. _rtc:
1164
1165rtc - RTC driver configuration
1166------------------------------
1167.. index:: rtc
1168
1169SYNOPSYS:
1170    .. code-block:: shell
1171
1172        rtc
1173
1174.. index:: CONFIGURE_SHELL_NO_COMMAND_RTC
1175.. index:: CONFIGURE_SHELL_COMMAND_RTC
1176
1177CONFIGURATION:
1178    This command is included in the default shell command set.  When building a
1179    custom command set, define ``CONFIGURE_SHELL_COMMAND_RTC`` to have this
1180    command included.
1181
1182    This command can be excluded from the shell command set by defining
1183    ``CONFIGURE_SHELL_NO_COMMAND_RTC`` when all shell commands have been
1184    configured.
1185
1186.. raw:: latex
1187
1188   \clearpage
1189
1190.. _i2cdetect:
1191
1192i2cdetect - detect I2C devices
1193------------------------------
1194.. index:: i2cdetect
1195
1196SYNOPSYS:
1197    .. code-block:: shell
1198
1199        i2cdetect <I2C_BUS>
1200
1201.. index:: CONFIGURE_SHELL_NO_COMMAND_I2CDETECT
1202.. index:: CONFIGURE_SHELL_COMMAND_I2CDETECT
1203
1204DESCRIPTION:
1205    Tries to detect I2C devices connected to the I2C bus. To do that, write
1206    requests with the length of 0 are used.
1207
1208    WARNING: This might confuse some I2C devices, so please use it only if you
1209    know what you are doing.
1210
1211    The command supports a ``-h`` option to get usage details.
1212
1213    The command works only with I2C bus drivers that use the Linux-Style API.
1214
1215EXAMPLES:
1216    The following is an example where two I2C devices are detected. One on 0x1a
1217    and one on 0x1f:
1218
1219    .. code-block:: shell
1220
1221        SHLL [/] # i2cdetect /dev/i2c1
1222            x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF
1223        0x     -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
1224        1x  -- -- -- -- -- -- -- -- -- -- 1a -- -- -- -- 1f
1225        2x  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
1226        3x  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
1227        4x  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
1228        5x  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
1229        6x  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
1230        7x  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
1231        SHLL [/] #
1232
1233CONFIGURATION:
1234    This command is included in the default shell command set.  When building a
1235    custom command set, define ``CONFIGURE_SHELL_COMMAND_I2CDETECT`` to have
1236    this command included.
1237
1238    This command can be excluded from the shell command set by defining
1239    ``CONFIGURE_SHELL_NO_COMMAND_I2CDETECT`` when all shell commands have been
1240    configured.
1241
1242.. raw:: latex
1243
1244   \clearpage
1245
1246.. _i2cget:
1247
1248i2cget - get data from an EEPROM like I2C device
1249------------------------------------------------
1250.. index:: i2cget
1251
1252SYNOPSYS:
1253    .. code-block:: shell
1254
1255        i2cget <I2C_BUS> <CHIP-ADDRESS> <DATA-ADDRESS> [<NR-BYTES>]
1256
1257.. index:: CONFIGURE_SHELL_NO_COMMAND_I2CGET
1258.. index:: CONFIGURE_SHELL_COMMAND_I2CGET
1259
1260DESCRIPTION:
1261    Get one or multiple bytes from an EEPROM like I2C device. If <NR-BYTES> is
1262    not given the command defaults to reading one byte. If you read multiple
1263    bytes (<NR-BYTES> given and bigger then 1) the read will be done in one
1264    single request. An auto incrementing register pointer is assumed.
1265
1266    The command supports a ``-h`` option to get usage details.
1267
1268    All numbers can be entered in decimal form (normal digits; e.g. 16),
1269    hexadecimal form (with 0x prefix; e.g. 0x10) or octal form (with a leading
1270    zero; e.g. 020).
1271
1272    The command works only with I2C bus drivers that use the Linux-Style API.
1273
1274EXAMPLES:
1275    The following is an example how to read a one byte register at 0xd from the
1276    I2C device at 0x1f:
1277
1278    .. code-block:: shell
1279
1280        SHLL [/] # i2cget /dev/i2c1 0x1f 0x0d
1281        0xc7
1282        SHLL [/] #
1283
1284CONFIGURATION:
1285    This command is included in the default shell command set.  When building a
1286    custom command set, define ``CONFIGURE_SHELL_COMMAND_I2CGET`` to have this
1287    command included.
1288
1289    This command can be excluded from the shell command set by defining
1290    ``CONFIGURE_SHELL_NO_COMMAND_I2CGET`` when all shell commands have been
1291    configured.
1292
1293.. raw:: latex
1294
1295   \clearpage
1296
1297.. _i2cset:
1298
1299i2cset - write data to an EEPROM like I2C device
1300------------------------------------------------
1301.. index:: i2cset
1302
1303SYNOPSYS:
1304    .. code-block:: shell
1305
1306        i2cset <I2C_BUS> <CHIP-ADDRESS> <DATA-ADDRESS> <VALUE> [<VALUE> [...]]
1307
1308.. index:: CONFIGURE_SHELL_NO_COMMAND_I2CSET
1309.. index:: CONFIGURE_SHELL_COMMAND_I2CSET
1310
1311DESCRIPTION:
1312    Write one or multiple bytes to an EEPROM like I2C device. If you write
1313    multiple bytes (multiple <VALUE> given) the write will be done in one single
1314    request. An auto incrementing register pointer is assumed.
1315
1316    The command supports a ``-h`` option to get usage details.
1317
1318    All numbers can be entered in decimal form (normal digits; e.g. 16),
1319    hexadecimal form (with 0x prefix; e.g. 0x10) or octal form (with a leading
1320    zero; e.g. 020).
1321
1322    The command works only with I2C bus drivers that use the Linux-Style API.
1323
1324EXAMPLES:
1325    The following is an example how to write one byte of 0x00 to the register at
1326    0x11 of the I2C device at 0x1f:
1327
1328    .. code-block:: shell
1329
1330        SHLL [/] # i2cset /dev/i2c1 0x1f 0x11 0x00
1331        SHLL [/] #
1332
1333CONFIGURATION:
1334    This command is included in the default shell command set.  When building a
1335    custom command set, define ``CONFIGURE_SHELL_COMMAND_I2CSET`` to have this
1336    command included.
1337
1338    This command can be excluded from the shell command set by defining
1339    ``CONFIGURE_SHELL_NO_COMMAND_I2CSET`` when all shell commands have been
1340    configured.
1341
1342.. raw:: latex
1343
1344   \clearpage
1345
1346.. _spi:
1347
1348spi - read and write simple data to an SPI bus
1349----------------------------------------------
1350.. index:: spi
1351
1352SYNOPSYS:
1353    .. code-block:: shell
1354
1355        spi [-loh] [-c <cs>] [-s <speed>] [-m <mode>] <SPI_BUS> xx [xx [..]]
1356
1357.. index:: CONFIGURE_SHELL_NO_COMMAND_SPI
1358.. index:: CONFIGURE_SHELL_COMMAND_SPI
1359
1360DESCRIPTION:
1361    Write data to an SPI bus and read the responses.
1362
1363    The command supports a ``-h`` option to get usage details.
1364
1365    The data bytes (``xx`` in the SYNOPSIS) are in hexadecimal form (e.g.
1366    ``0x10`` or ``10`` both have a value of decimal 16). This allows longer
1367    hex strings before the shell input limit is reached. All other numbers can
1368    be entered in decimal form (normal digits; e.g. 16), hexadecimal form (with
1369    0x prefix; e.g. 0x10) or octal form (with a leading zero; e.g. 020).
1370
1371    The command works only with SPI bus drivers that use the Linux-Style API.
1372
1373EXAMPLES:
1374    The following is an example how to write multiple bytes (0x4a 0x4b 0x4c) to
1375    the bus. The response is 0xa1 0xa2 0xa3 in this case. Chip select 1 will be
1376    used.
1377
1378    .. code-block:: shell
1379
1380        SHLL [/] # spi /dev/spi1 -c 1 4a 4b 4c
1381        received: a1 a2 a3
1382        SHLL [/] #
1383
1384CONFIGURATION:
1385    This command is included in the default shell command set.  When building a
1386    custom command set, define ``CONFIGURE_SHELL_COMMAND_SPI`` to have this
1387    command included.
1388
1389    This command can be excluded from the shell command set by defining
1390    ``CONFIGURE_SHELL_NO_COMMAND_SPI`` when all shell commands have been
1391    configured.
1392
1393.. raw:: latex
1394
1395   \clearpage
1396
1397.. _exit:
1398
1399exit - exit the shell
1400---------------------
1401.. index:: exit
1402
1403SYNOPSYS:
1404    .. code-block:: shell
1405
1406        exit
1407
1408DESCRIPTION:
1409    This command causes the shell interpreter to ``exit``.
1410
1411EXIT STATUS:
1412    This command does not return.
1413
1414NOTES:
1415    In contrast to `logoff - logoff from the system`, this command is built
1416    into the shell interpreter loop.
1417
1418EXAMPLES:
1419    The following is an example of how to use ``exit``:
1420
1421    .. code-block:: shell
1422
1423        SHLL [/] $ exit
1424        Shell exiting
1425
1426CONFIGURATION:
1427    This command is always present and cannot be disabled.
1428
1429PROGRAMMING INFORMATION:
1430    The ``exit`` is implemented directly in the shell interpreter.  There is no
1431    C routine associated with it.
Note: See TracBrowser for help on using the repository browser.