summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2021-06-02 16:07:11 +0200
committerDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2021-06-02 16:07:25 +0200
commita4a6b9237cd01da78206de8894a1a009705ce796 (patch)
tree6f54b244d322a919bf3d5ad1d28a73e82d6a0f62
parent4292ac8e7f6ab0f84f97ad86cf59a82b7fea2cee (diff)
downloadexynos-gpio-tool-a4a6b9237cd01da78206de8894a1a009705ce796.tar.gz
exynos-gpio-tool-a4a6b9237cd01da78206de8894a1a009705ce796.tar.bz2
exynos-gpio-tool-a4a6b9237cd01da78206de8894a1a009705ce796.zip
tests: pass it gpio_hardware_blocks_addr
This will enable us to more easily convert the various functions like gpio_* to use it later on. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-rw-r--r--exynos4412_gpios.c2
-rw-r--r--main.c2
-rw-r--r--tests.c21
-rw-r--r--tests.h3
4 files changed, 18 insertions, 10 deletions
diff --git a/exynos4412_gpios.c b/exynos4412_gpios.c
index e9f23f5..9e3170a 100644
--- a/exynos4412_gpios.c
+++ b/exynos4412_gpios.c
@@ -121,7 +121,7 @@ int dump_gpio_infos(int debug, char *devmem, int fd, size_t page_size,
}
int gpio_get_direction(char *devmem, int fd, size_t page_size, char *bank,
- uint32_t gpio_offset)
+ uint32_t gpio_offset)
{
int debug = 0;
diff --git a/main.c b/main.c
index 2161503..226cb59 100644
--- a/main.c
+++ b/main.c
@@ -199,7 +199,7 @@ int main(int argc, char *argv[])
return dump_modem_gpio_infos(debug, devmem, fd, page_size,
gpio_hardware_blocks_addr);
} else if (argc == 2 && !strcmp("test", argv[1])) {
- return run_tests(debug, devmem, fd, page_size);
+ return run_tests(debug, devmem, fd, page_size, gpio_hardware_blocks_addr);
} else {
usage(argv[0]);
return EX_USAGE;
diff --git a/tests.c b/tests.c
index 3d89b67..8e74438 100644
--- a/tests.c
+++ b/tests.c
@@ -56,8 +56,9 @@ static int run_command(int debug, char *command)
}
static int test_output_value_with_libgpiod(int debug, char *devmem, int fd,
- size_t page_size, char *bank,
- int gpio_offset)
+ size_t page_size,
+ void *gpio_hardware_blocks_addr,
+ char *bank, int gpio_offset)
{
char *gpioset_high_command;
char *gpioset_low_command;
@@ -107,7 +108,8 @@ static int test_output_value_with_libgpiod(int debug, char *devmem, int fd,
}
static int test_flash_with_devmem2(int debug, char *devmem, int fd,
- size_t page_size)
+ size_t page_size,
+ void *gpio_hardware_blocks_addr)
{
int rc;
@@ -176,8 +178,9 @@ static int test_flash_with_devmem2(int debug, char *devmem, int fd,
}
static int test_direction_with_libgpiod(int debug, char *devmem, int fd,
- size_t page_size, char *bank,
- int gpio_offset)
+ size_t page_size,
+ void *gpio_hardware_blocks_addr,
+ char *bank, int gpio_offset)
{
char *gpioget_command;
char *gpioset_command;
@@ -220,7 +223,8 @@ static int test_direction_with_libgpiod(int debug, char *devmem, int fd,
return 0;
}
-int run_tests(int debug, char *devmem, int fd, size_t page_size)
+int run_tests(int debug, char *devmem, int fd, size_t page_size,
+ void *gpio_hardware_blocks_addr)
{
bool has_devmem2;
bool has_gpioget;
@@ -232,10 +236,12 @@ int run_tests(int debug, char *devmem, int fd, size_t page_size)
if (has_gpioget && has_gpioset) {
test_direction_with_libgpiod(debug, devmem, fd, page_size,
+ gpio_hardware_blocks_addr,
"gpj1", 1);
printf("[ OK ] libgpiod GPIO direction test\n");
test_output_value_with_libgpiod(debug, devmem, fd, page_size,
+ gpio_hardware_blocks_addr,
"gpj1", 1);
printf("[ OK ] libgpiod GPIO output value test\n");
} else {
@@ -249,7 +255,8 @@ int run_tests(int debug, char *devmem, int fd, size_t page_size)
}
if (has_devmem2) {
- test_flash_with_devmem2(debug, devmem, fd, page_size);
+ test_flash_with_devmem2(debug, devmem, fd, page_size,
+ gpio_hardware_blocks_addr);
} else {
printf("[ !! ] devmem2 not found: skipping"
" devmem2 direction and output tests\n");
diff --git a/tests.h b/tests.h
index b3a2923..b98ec4a 100644
--- a/tests.h
+++ b/tests.h
@@ -20,6 +20,7 @@
#include <stddef.h>
-int run_tests(int debug, char *devmem, int fd, size_t page_size);
+int run_tests(int debug, char *devmem, int fd, size_t page_size,
+ void *gpio_hardware_blocks_addr);
#endif /* TESTS_H */