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