X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=tools%2Fcarlu%2Fsrc%2Ftest.c;h=bf49559fa057ee44908da1e4746eb05d263382dc;hb=b12493d10516555d86ec0be9d0a09973468ec04c;hp=148f89a0540556d32c4549db065da251f5121246;hpb=a5cc1f3fc4462940dd9fabb45a865d372d24d1f4;p=carl9170fw.git diff --git a/tools/carlu/src/test.c b/tools/carlu/src/test.c index 148f89a..bf49559 100644 --- a/tools/carlu/src/test.c +++ b/tools/carlu/src/test.c @@ -1,9 +1,9 @@ /* - * carl9170user - userspace testing utility for ar9170 devices + * carlu - userspace testing utility for ar9170 devices * * Various tests * - * Copyright 2009, 2010 Christian Lamparter + * Copyright 2009-2011 Christian Lamparter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -197,8 +197,8 @@ int carlu_gpio_test(struct carlu *ar) #define CHK(cmd) \ do { \ - int __err; \ - if ((__err = cmd)) \ + int __err = cmd; \ + if ((__err)) \ return __err; \ } while (0) @@ -220,3 +220,18 @@ int carlu_gpio_test(struct carlu *ar) CHK(carlu_cmd_read_mem(ar, AR9170_GPIO_REG_PORT_DATA, &gpio)); info("GPIO state:%x\n", gpio); } + +int carlu_random_test(struct carlu *ar) +{ + uint32_t buf[4096]; + int err, i; + + err = carlu_cmd_mem_watch(ar, AR9170_RAND_REG_NUM, sizeof(buf), buf); + if (err) + return err; + + for (i = 0; i < ARRAY_SIZE(buf); i++) + info("%.2x %.2x ", buf[i] & 0xff, buf[i] >> 8); + + info("\n"); +}