X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=tools%2Fcarlu%2Fsrc%2Fmain.c;h=c1b32778333c897570702dc4166a05b20394d30d;hb=12cc2cc355d1dce3d50c78e0f680b3cda0c73dfe;hp=4f2058328b6b66655828402024821c89c1104fd5;hpb=e72388a0aa23da8bc8e24a0cbe9d523c5a9ce294;p=carl9170fw.git diff --git a/tools/carlu/src/main.c b/tools/carlu/src/main.c index 4f20583..c1b3277 100644 --- a/tools/carlu/src/main.c +++ b/tools/carlu/src/main.c @@ -1,9 +1,9 @@ /* - * carl9170user - userspace testing utility for ar9170 devices + * carlu - userspace testing utility for ar9170 devices * * main program routine * - * 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 @@ -38,6 +38,7 @@ #include "usb.h" #include "frame.h" #include "test.h" +#include "cmd.h" void *carlu_alloc_driver(size_t size) { @@ -133,6 +134,60 @@ out: return err ? EXIT_FAILURE : EXIT_SUCCESS; } +static int carlu_run_gpio_test(void) +{ + struct carlu *carl = NULL; + int err; + + err = carlu_init(); + if (err) + goto out; + + carl = carlusb_probe(); + if (IS_ERR_OR_NULL(carl)) { + err = PTR_ERR(carl); + goto out; + } + + err = carlu_gpio_test(carl); + if (err) + goto out_close; + +out_close: + carlusb_close(carl); + +out: + carlu_exit(); + return err ? EXIT_FAILURE : EXIT_SUCCESS; +} + +static int carlu_run_random_test(void) +{ + struct carlu *carl = NULL; + int err; + + err = carlu_init(); + if (err) + goto out; + + carl = carlusb_probe(); + if (IS_ERR_OR_NULL(carl)) { + err = PTR_ERR(carl); + goto out; + } + + err = carlu_random_test(carl); + if (err) + goto out_close; + +out_close: + carlusb_close(carl); + +out: + carlu_exit(); + return err ? EXIT_FAILURE : EXIT_SUCCESS; +} + static int carlu_run_loop_test(void) { struct carlu *carl; @@ -207,6 +262,8 @@ static const struct menu_struct menu[] = { MENU_ITEM('l', carlusb_print_known_devices, "list of all known ar9170 usb devices."), MENU_ITEM('p', carlu_probe_all, "probe all possible devices."), MENU_ITEM('t', carlu_run_loop_test, "run tx/rx test."), + MENU_ITEM('g', carlu_run_gpio_test, "flash the leds."), + MENU_ITEM('r', carlu_run_random_test, "get random numbers."), }; static int show_help(void)