cmdline.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. //###########################################################################
  2. //
  3. // FILE: cmdline.h
  4. //
  5. // TITLE: Prototypes for command line processing functions.
  6. //
  7. //###########################################################################
  8. // $TI Release: F2837xD Support Library v3.05.00.00 $
  9. // $Release Date: Tue Jun 26 03:15:23 CDT 2018 $
  10. // $Copyright:
  11. // Copyright (C) 2013-2018 Texas Instruments Incorporated - http://www.ti.com/
  12. //
  13. // Redistribution and use in source and binary forms, with or without
  14. // modification, are permitted provided that the following conditions
  15. // are met:
  16. //
  17. // Redistributions of source code must retain the above copyright
  18. // notice, this list of conditions and the following disclaimer.
  19. //
  20. // Redistributions in binary form must reproduce the above copyright
  21. // notice, this list of conditions and the following disclaimer in the
  22. // documentation and/or other materials provided with the
  23. // distribution.
  24. //
  25. // Neither the name of Texas Instruments Incorporated nor the names of
  26. // its contributors may be used to endorse or promote products derived
  27. // from this software without specific prior written permission.
  28. //
  29. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  30. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  31. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  32. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  33. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  34. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  35. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  36. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  37. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  38. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  39. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  40. // $
  41. //###########################################################################
  42. #ifndef __CMDLINE_H__
  43. #define __CMDLINE_H__
  44. //*****************************************************************************
  45. //
  46. // If building with a C++ compiler, make all of the definitions in this header
  47. // have a C binding.
  48. //
  49. //*****************************************************************************
  50. #ifdef __cplusplus
  51. extern "C"
  52. {
  53. #endif
  54. //*****************************************************************************
  55. //
  56. //! \addtogroup cmdline_api
  57. //! @{
  58. //
  59. //*****************************************************************************
  60. //
  61. //! Defines the value that is returned if the command is not found.
  62. //
  63. #define CMDLINE_BAD_CMD (-1)
  64. //
  65. //! Defines the value that is returned if there are too many arguments.
  66. //
  67. #define CMDLINE_TOO_MANY_ARGS (-2)
  68. //
  69. //! Defines the value that is returned if there are too few arguments.
  70. //
  71. #define CMDLINE_TOO_FEW_ARGS (-3)
  72. //
  73. //! Defines the value that is returned if an argument is invalid.
  74. //
  75. #define CMDLINE_INVALID_ARG (-4)
  76. //
  77. // Command line function callback type.
  78. //
  79. typedef int (*pfnCmdLine)(int argc, char *argv[]);
  80. //
  81. //! Structure for an entry in the command list table.
  82. //
  83. typedef struct
  84. {
  85. //
  86. //! A pointer to a string containing the name of the command.
  87. //
  88. const char *pcCmd;
  89. //
  90. //! A function pointer to the implementation of the command.
  91. //
  92. pfnCmdLine pfnCmd;
  93. //
  94. //! A pointer to a string of brief help text for the command.
  95. //
  96. const char *pcHelp;
  97. }
  98. tCmdLineEntry;
  99. //
  100. //! This is the command table that must be provided by the application. The
  101. //! last element of the array must be a structure whose pcCmd field contains
  102. //! a NULL pointer.
  103. //
  104. extern tCmdLineEntry g_psCmdTable[];
  105. //*****************************************************************************
  106. //
  107. // Close the Doxygen group.
  108. //! @}
  109. //
  110. //*****************************************************************************
  111. //
  112. // Function Prototypes
  113. //
  114. extern int CmdLineProcess(char *pcCmdLine);
  115. //*****************************************************************************
  116. //
  117. // Mark the end of the C bindings section for C++ compilers.
  118. //
  119. //*****************************************************************************
  120. #ifdef __cplusplus
  121. }
  122. #endif
  123. #endif // __CMDLINE_H__
  124. //
  125. // End of file
  126. //