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