Rasmus Villemoes | 1f6b4f0 | 2023-03-02 09:12:23 +0100 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0-or-later: |
| 2 | |
| 3 | read and write commands |
| 4 | ======================= |
| 5 | |
| 6 | Synopsis |
| 7 | -------- |
| 8 | |
| 9 | :: |
| 10 | |
| 11 | read <interface> <dev[:part|#partname]> <addr> <blk#> <cnt> |
| 12 | write <interface> <dev[:part|#partname]> <addr> <blk#> <cnt> |
| 13 | |
| 14 | The read and write commands can be used for raw access to data in |
| 15 | block devices (or partitions therein), i.e. without going through a |
| 16 | file system. |
| 17 | |
| 18 | read |
| 19 | ---- |
| 20 | |
| 21 | The block device is specified using the <interface> (e.g. "mmc") and |
| 22 | <dev> parameters. If the block device has a partition table, one can |
| 23 | optionally specify a partition number (using the :part syntax) or |
| 24 | partition name (using the #partname syntax). The command then reads |
| 25 | the <cnt> blocks of data starting at block number <blk#> of the given |
| 26 | device/partition to the memory address <addr>. |
| 27 | |
| 28 | write |
| 29 | ----- |
| 30 | |
| 31 | The write command is completely equivalent to the read command, except |
| 32 | of course that the transfer direction is reversed. |
| 33 | |
| 34 | Examples |
| 35 | -------- |
| 36 | |
| 37 | # Read 2 MiB from partition 3 of mmc device 2 to $loadaddr |
| 38 | read mmc 2.3 $loadaddr 0 0x1000 |
| 39 | |
| 40 | # Read 16 MiB from the partition named 'kernel' of mmc device 1 to $loadaddr |
| 41 | read mmc 1#kernel $loadaddr 0 0x8000 |
| 42 | |
| 43 | # Write to the third sector of the partition named 'bootdata' of mmc device 0 |
| 44 | write mmc 0#bootdata $loadaddr 2 1 |