aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/spi
diff options
context:
space:
mode:
authorAdrian Remonda <adrianremonda@gmail.com>2015-03-10 16:12:31 -0400
committerMark Brown <broonie@kernel.org>2015-03-10 16:51:04 -0400
commit31a5c5a72b90e074bd2377ada2bdfd506801ed72 (patch)
treeca0cd55dcab42f033edd254d186d21b04af0c4fd /Documentation/spi
parentb78ce7ed54093e5e63d4f5d7cbdc3f7d42ebbd5c (diff)
spi: spidev_test: Added verbose output
Signed-off-by: Adrian Remonda <adrianremonda@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'Documentation/spi')
-rw-r--r--Documentation/spi/spidev_test.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/Documentation/spi/spidev_test.c b/Documentation/spi/spidev_test.c
index 9cb09184a3d6..4b6a3803638b 100644
--- a/Documentation/spi/spidev_test.c
+++ b/Documentation/spi/spidev_test.c
@@ -35,6 +35,7 @@ static uint32_t mode;
35static uint8_t bits = 8; 35static uint8_t bits = 8;
36static uint32_t speed = 500000; 36static uint32_t speed = 500000;
37static uint16_t delay; 37static uint16_t delay;
38static int verbose;
38 39
39static void hex_dump(const void *src, size_t length, size_t line_size, char *prefix) 40static void hex_dump(const void *src, size_t length, size_t line_size, char *prefix)
40{ 41{
@@ -104,6 +105,8 @@ static void transfer(int fd)
104 if (ret < 1) 105 if (ret < 1)
105 pabort("can't send spi message"); 106 pabort("can't send spi message");
106 107
108 if (verbose)
109 hex_dump(tx, ARRAY_SIZE(tx), 32, "TX");
107 hex_dump(rx, ARRAY_SIZE(rx), 32, "RX"); 110 hex_dump(rx, ARRAY_SIZE(rx), 32, "RX");
108} 111}
109 112
@@ -120,6 +123,7 @@ static void print_usage(const char *prog)
120 " -L --lsb least significant bit first\n" 123 " -L --lsb least significant bit first\n"
121 " -C --cs-high chip select active high\n" 124 " -C --cs-high chip select active high\n"
122 " -3 --3wire SI/SO signals shared\n" 125 " -3 --3wire SI/SO signals shared\n"
126 " -v --verbose Verbose (show tx buffer)\n"
123 " -N --no-cs no chip select\n" 127 " -N --no-cs no chip select\n"
124 " -R --ready slave pulls low to pause\n" 128 " -R --ready slave pulls low to pause\n"
125 " -2 --dual dual transfer\n" 129 " -2 --dual dual transfer\n"
@@ -144,12 +148,13 @@ static void parse_opts(int argc, char *argv[])
144 { "no-cs", 0, 0, 'N' }, 148 { "no-cs", 0, 0, 'N' },
145 { "ready", 0, 0, 'R' }, 149 { "ready", 0, 0, 'R' },
146 { "dual", 0, 0, '2' }, 150 { "dual", 0, 0, '2' },
151 { "verbose", 0, 0, 'v' },
147 { "quad", 0, 0, '4' }, 152 { "quad", 0, 0, '4' },
148 { NULL, 0, 0, 0 }, 153 { NULL, 0, 0, 0 },
149 }; 154 };
150 int c; 155 int c;
151 156
152 c = getopt_long(argc, argv, "D:s:d:b:lHOLC3NR24", lopts, NULL); 157 c = getopt_long(argc, argv, "D:s:d:b:lHOLC3NR24:v", lopts, NULL);
153 158
154 if (c == -1) 159 if (c == -1)
155 break; 160 break;
@@ -188,6 +193,9 @@ static void parse_opts(int argc, char *argv[])
188 case 'N': 193 case 'N':
189 mode |= SPI_NO_CS; 194 mode |= SPI_NO_CS;
190 break; 195 break;
196 case 'v':
197 verbose = 1;
198 break;
191 case 'R': 199 case 'R':
192 mode |= SPI_READY; 200 mode |= SPI_READY;
193 break; 201 break;