[3478841] | 1 | /** |
---|
[a163882] | 2 | * @file rtems/bspcmdline.h |
---|
[3478841] | 3 | * |
---|
[a163882] | 4 | * @defgroup BSPCommandLine BSP Command Line Helpers |
---|
[9ab091e] | 5 | * |
---|
[a163882] | 6 | * @ingroup libmisc |
---|
| 7 | * @brief BSP Command Line Handler |
---|
| 8 | * |
---|
| 9 | * This include file contains all prototypes and specifications |
---|
| 10 | * related to the BSP Command Line String and associated helper |
---|
| 11 | * routines. The helpers are useful for locating command line |
---|
| 12 | * type arguments (e.g. --mode) and their associated right |
---|
| 13 | * hand side (e.g. FAST in --mode=FAST). |
---|
[3478841] | 14 | */ |
---|
| 15 | |
---|
| 16 | /* |
---|
| 17 | * COPYRIGHT (c) 1989-2009. |
---|
| 18 | * On-Line Applications Research Corporation (OAR). |
---|
| 19 | * |
---|
| 20 | * The license and distribution terms for this file may be |
---|
| 21 | * found in the file LICENSE in this distribution or at |
---|
[c499856] | 22 | * http://www.rtems.org/license/LICENSE. |
---|
[3478841] | 23 | */ |
---|
| 24 | |
---|
| 25 | #ifndef __BSP_COMMAND_LINE_h |
---|
| 26 | #define __BSP_COMMAND_LINE_h |
---|
| 27 | |
---|
| 28 | /** |
---|
[a163882] | 29 | * @defgroup BSPCommandLine BSP Command Line Helpers |
---|
[3478841] | 30 | * |
---|
[a163882] | 31 | * The BSP Command Line Handler provides a set of routines which assist |
---|
| 32 | * in examining and decoding the Command Line String passed to the BSP |
---|
| 33 | * at boot time. |
---|
[3478841] | 34 | */ |
---|
| 35 | /**@{*/ |
---|
| 36 | |
---|
[f5c405e] | 37 | #include <stddef.h> /* for size_t */ |
---|
| 38 | |
---|
[3478841] | 39 | #ifdef __cplusplus |
---|
| 40 | extern "C" { |
---|
| 41 | #endif |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | /** |
---|
[a163882] | 45 | * @brief Obtain Pointer to BSP Boot Command String |
---|
[3478841] | 46 | * |
---|
[a163882] | 47 | * This method returns a pointer to the BSP Boot Command String. It |
---|
| 48 | * is as likely to be NULL as point to a string as most BSPs do not |
---|
| 49 | * have a start environment that provides a boot string. |
---|
[3478841] | 50 | * |
---|
[a163882] | 51 | * @retval This method returns the pointer to the BSP Boot Command String. |
---|
[3478841] | 52 | */ |
---|
[52976086] | 53 | const char *rtems_bsp_cmdline_get(void); |
---|
[3478841] | 54 | |
---|
| 55 | /** |
---|
[a163882] | 56 | * @brief Obtain COPY of the Entire Matching Argument |
---|
| 57 | * |
---|
| 58 | * This method searches for the argument @a name in the BSP Boot Command |
---|
| 59 | * String and returns a copy of the entire string associated with it in |
---|
| 60 | * @a value up to a string of @a length. This will include the argument |
---|
| 61 | * and any right hand side portion of the string. For example, one might |
---|
| 62 | * be returned --mode=FAST if |
---|
| 63 | * searching for --mode. |
---|
| 64 | * |
---|
| 65 | * @param[in] name is the arugment to search for |
---|
| 66 | * @param[in] value points to where the contents will |
---|
| 67 | * be placed if located. |
---|
| 68 | * @param[in] length is the maximum length to copy |
---|
| 69 | * |
---|
| 70 | * @return This method returns NULL if not found and |
---|
| 71 | * @a value if found. |
---|
[3478841] | 72 | */ |
---|
[52976086] | 73 | const char *rtems_bsp_cmdline_get_param( |
---|
[3478841] | 74 | const char *name, |
---|
| 75 | char *value, |
---|
| 76 | size_t length |
---|
| 77 | ); |
---|
| 78 | |
---|
| 79 | |
---|
| 80 | /** |
---|
[a163882] | 81 | * @brief Obtain COPY of the Right Hand Side of the Matching Argument |
---|
| 82 | * |
---|
| 83 | * This method searches for the argument @a name in |
---|
| 84 | * the BSP Boot Command String and returns the right hand side |
---|
| 85 | * associated with it in @a value up to a maximum string @a length. |
---|
| 86 | * This will NOT include the argument but only any right hand side |
---|
| 87 | * portion of the string. * For example, one might be returned FAST if |
---|
| 88 | * searching for --mode. |
---|
| 89 | * |
---|
| 90 | * @param[in] name is the arugment to search for |
---|
| 91 | * @param[in] value points to where the contents will |
---|
| 92 | * be placed if located. |
---|
| 93 | * @param[in] length is the maximum length to copy |
---|
| 94 | * |
---|
| 95 | * @retval This method returns NULL if not found and |
---|
| 96 | * @a value if found. |
---|
[3478841] | 97 | */ |
---|
[52976086] | 98 | const char *rtems_bsp_cmdline_get_param_rhs( |
---|
[3478841] | 99 | const char *name, |
---|
| 100 | char *value, |
---|
| 101 | size_t length |
---|
| 102 | ); |
---|
| 103 | |
---|
| 104 | /** |
---|
[a163882] | 105 | * @brief Obtain Pointer to the Entire Matching Argument |
---|
[3478841] | 106 | * |
---|
[a163882] | 107 | * This method searches for the argument @a name in |
---|
| 108 | * the BSP Boot Command String and returns a pointer to the |
---|
| 109 | * entire string associated with it. This will include the |
---|
| 110 | * argument and any right hand side portion of the string. |
---|
| 111 | * For example, one might be returned --mode=FAST if |
---|
| 112 | * searching for --mode. |
---|
[3478841] | 113 | * |
---|
[a163882] | 114 | * @param[in] name is the arugment to search for |
---|
[3478841] | 115 | * |
---|
[a163882] | 116 | * @retval This method returns NULL if not found and a pointer |
---|
| 117 | * into the BSP Boot Command String if found. |
---|
[3478841] | 118 | * |
---|
[a163882] | 119 | * @note The pointer will be to the original BSP Command |
---|
| 120 | * Line string. Exercise caution when using this. |
---|
[3478841] | 121 | */ |
---|
[52976086] | 122 | const char *rtems_bsp_cmdline_get_param_raw( |
---|
[3478841] | 123 | const char *name |
---|
| 124 | ); |
---|
| 125 | |
---|
| 126 | #ifdef __cplusplus |
---|
| 127 | } |
---|
| 128 | #endif |
---|
| 129 | |
---|
| 130 | /**@}*/ |
---|
| 131 | #endif |
---|