Simon Glass | c892511 | 2023-06-01 10:23:02 -0600 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+: |
| 2 | |
Heinrich Schuchardt | 1b0c316 | 2024-01-14 14:53:13 +0100 | [diff] [blame^] | 3 | .. index:: |
| 4 | single: cedit (command) |
| 5 | |
Simon Glass | c892511 | 2023-06-01 10:23:02 -0600 | [diff] [blame] | 6 | cedit command |
| 7 | ============= |
| 8 | |
| 9 | Synopis |
| 10 | ------- |
| 11 | |
| 12 | :: |
| 13 | |
| 14 | cedit load <interface> <dev[:part]> <filename> |
| 15 | cedit run |
Simon Glass | 28bf435 | 2023-08-14 16:40:33 -0600 | [diff] [blame] | 16 | cedit write_fdt <dev[:part]> <filename> |
Simon Glass | b1cd32b | 2023-08-14 16:40:34 -0600 | [diff] [blame] | 17 | cedit read_fdt <dev[:part]> <filename> |
Simon Glass | 237f375 | 2023-08-14 16:40:35 -0600 | [diff] [blame] | 18 | cedit write_env [-v] |
Simon Glass | 0f2e5a6 | 2023-08-14 16:40:36 -0600 | [diff] [blame] | 19 | cedit read_env [-v] |
Simon Glass | 2b91ca6 | 2023-08-14 16:40:37 -0600 | [diff] [blame] | 20 | cedit write_cmos [-v] [dev] |
Simon Glass | c892511 | 2023-06-01 10:23:02 -0600 | [diff] [blame] | 21 | |
| 22 | Description |
| 23 | ----------- |
| 24 | |
| 25 | The *cedit* command is used to load a configuration-editor description and allow |
| 26 | the user to interact with it. |
| 27 | |
| 28 | It makes use of the expo subsystem. |
| 29 | |
| 30 | The description is in the form of a devicetree file, as documented at |
| 31 | :ref:`expo_format`. |
| 32 | |
Simon Glass | 40eb3c3 | 2023-08-14 16:40:29 -0600 | [diff] [blame] | 33 | See :doc:`../../develop/cedit` for information about the configuration editor. |
| 34 | |
Simon Glass | f8cb2e8 | 2023-08-14 16:40:31 -0600 | [diff] [blame] | 35 | cedit load |
| 36 | ~~~~~~~~~~ |
| 37 | |
| 38 | Loads a configuration-editor description from a file. It creates a new cedit |
| 39 | structure ready for use. Initially no settings are read, so default values are |
| 40 | used for each object. |
| 41 | |
| 42 | cedit run |
| 43 | ~~~~~~~~~ |
| 44 | |
| 45 | Runs the default configuration-editor event loop. This is very simple, just |
| 46 | accepting character input and moving through the objects under user control. |
| 47 | The implementation is at `cedit_run()`. |
| 48 | |
Simon Glass | 28bf435 | 2023-08-14 16:40:33 -0600 | [diff] [blame] | 49 | cedit write_fdt |
| 50 | ~~~~~~~~~~~~~~~ |
| 51 | |
| 52 | Writes the current user settings to a devicetree file. For each menu item the |
| 53 | selected ID and its text string are written. |
| 54 | |
Simon Glass | b1cd32b | 2023-08-14 16:40:34 -0600 | [diff] [blame] | 55 | cedit read_fdt |
| 56 | ~~~~~~~~~~~~~~ |
| 57 | |
| 58 | Reads the user settings from a devicetree file and updates the cedit with those |
| 59 | settings. |
Simon Glass | f8cb2e8 | 2023-08-14 16:40:31 -0600 | [diff] [blame] | 60 | |
Simon Glass | 0f2e5a6 | 2023-08-14 16:40:36 -0600 | [diff] [blame] | 61 | cedit read_env |
| 62 | ~~~~~~~~~~~~~~ |
| 63 | |
| 64 | Reads the settings from the environment variables. For each menu item `<name>`, |
| 65 | cedit looks for a variable called `c.<name>` with the ID of the selected menu |
| 66 | item. |
| 67 | |
| 68 | The `-v` flag enables verbose mode, where each variable is printed after it is |
| 69 | read. |
| 70 | |
Simon Glass | 237f375 | 2023-08-14 16:40:35 -0600 | [diff] [blame] | 71 | cedit write_env |
| 72 | ~~~~~~~~~~~~~~~ |
| 73 | |
| 74 | Writes the settings to environment variables. For each menu item the selected |
| 75 | ID and its text string are written, similar to: |
| 76 | |
| 77 | setenv c.<name> <selected_id> |
| 78 | setenv c.<name>-str <selected_id's text string> |
| 79 | |
| 80 | The `-v` flag enables verbose mode, where each variable is printed before it is |
| 81 | set. |
| 82 | |
Simon Glass | 2b91ca6 | 2023-08-14 16:40:37 -0600 | [diff] [blame] | 83 | cedit write_cmos |
| 84 | ~~~~~~~~~~~~~~~~ |
| 85 | |
| 86 | Writes the settings to locations in the CMOS RAM. The locations used are |
| 87 | specified by the schema. See `expo_format_`. |
| 88 | |
| 89 | The `-v` flag enables verbose mode, which shows which CMOS locations were |
| 90 | updated. |
| 91 | |
| 92 | Normally the first RTC device is used to hold the data. You can specify a |
| 93 | different device by name using the `dev` parameter. |
| 94 | |
Simon Glass | 237f375 | 2023-08-14 16:40:35 -0600 | [diff] [blame] | 95 | |
Simon Glass | c892511 | 2023-06-01 10:23:02 -0600 | [diff] [blame] | 96 | Example |
| 97 | ------- |
| 98 | |
| 99 | :: |
| 100 | |
| 101 | => cedit load hostfs - fred.dtb |
| 102 | => cedit run |
Simon Glass | 28bf435 | 2023-08-14 16:40:33 -0600 | [diff] [blame] | 103 | => cedit write_fdt hostfs - settings.dtb |
| 104 | |
| 105 | That results in:: |
| 106 | |
| 107 | / { |
| 108 | cedit-values { |
| 109 | cpu-speed = <0x00000006>; |
| 110 | cpu-speed-str = "2 GHz"; |
| 111 | power-loss = <0x0000000a>; |
| 112 | power-loss-str = "Always Off"; |
| 113 | }; |
| 114 | } |
Simon Glass | b1cd32b | 2023-08-14 16:40:34 -0600 | [diff] [blame] | 115 | |
| 116 | => cedit read_fdt hostfs - settings.dtb |
Simon Glass | 237f375 | 2023-08-14 16:40:35 -0600 | [diff] [blame] | 117 | |
| 118 | This shows settings being stored in the environment:: |
| 119 | |
| 120 | => cedit write_env -v |
Simon Glass | 0f2e5a6 | 2023-08-14 16:40:36 -0600 | [diff] [blame] | 121 | c.cpu-speed=7 |
| 122 | c.cpu-speed-str=2.5 GHz |
| 123 | c.power-loss=12 |
| 124 | c.power-loss-str=Memory |
Simon Glass | 237f375 | 2023-08-14 16:40:35 -0600 | [diff] [blame] | 125 | => print |
| 126 | ... |
| 127 | c.cpu-speed=6 |
| 128 | c.cpu-speed-str=2 GHz |
| 129 | c.power-loss=10 |
| 130 | c.power-loss-str=Always Off |
| 131 | ... |
Simon Glass | 0f2e5a6 | 2023-08-14 16:40:36 -0600 | [diff] [blame] | 132 | |
| 133 | => cedit read_env -v |
| 134 | c.cpu-speed=7 |
| 135 | c.power-loss=12 |
Simon Glass | 2b91ca6 | 2023-08-14 16:40:37 -0600 | [diff] [blame] | 136 | |
| 137 | This shows writing to CMOS RAM. Notice that the bytes at 80 and 84 change:: |
| 138 | |
| 139 | => rtc read 80 8 |
| 140 | 00000080: 00 00 00 00 00 2f 2a 08 ...../*. |
Simon Glass | 4462fa3 | 2023-08-14 16:40:38 -0600 | [diff] [blame] | 141 | => cedit write_cmos -v |
Simon Glass | 2b91ca6 | 2023-08-14 16:40:37 -0600 | [diff] [blame] | 142 | Write 2 bytes from offset 80 to 84 |
| 143 | => rtc read 80 8 |
| 144 | 00000080: 01 00 00 00 08 2f 2a 08 ...../*. |
Simon Glass | 4462fa3 | 2023-08-14 16:40:38 -0600 | [diff] [blame] | 145 | => cedit read_cmos -v |
| 146 | Read 2 bytes from offset 80 to 84 |
| 147 | |
| 148 | Here is an example with the device specified:: |
| 149 | |
| 150 | => cedit write_cmos rtc@43 |
| 151 | => |