From: Bartosz Golaszewski Date: Mon, 2 Oct 2017 12:26:42 +0000 (+0200) Subject: line: use a common prefix for all line defines X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=944d44339d9796caa6a2239f0eebb40555214c02;p=qemu-gpiodev%2Flibgpiod.git line: use a common prefix for all line defines Prefix all constants used by line functions with GPIOD_LINE_. Signed-off-by: Bartosz Golaszewski --- diff --git a/include/gpiod.h b/include/gpiod.h index 7e33197..1f7b645 100644 --- a/include/gpiod.h +++ b/include/gpiod.h @@ -372,17 +372,17 @@ gpiod_chip_find_line(struct gpiod_chip *chip, const char *name) GPIOD_API; * @brief Available types of requests. */ enum { - GPIOD_REQUEST_DIRECTION_AS_IS, + GPIOD_LINE_REQUEST_DIRECTION_AS_IS, /**< Request the line(s), but don't change current direction. */ - GPIOD_REQUEST_DIRECTION_INPUT, + GPIOD_LINE_REQUEST_DIRECTION_INPUT, /**< Request the line(s) for reading the GPIO line state. */ - GPIOD_REQUEST_DIRECTION_OUTPUT, + GPIOD_LINE_REQUEST_DIRECTION_OUTPUT, /**< Request the line(s) for setting the GPIO line state. */ - GPIOD_REQUEST_EVENT_FALLING_EDGE, + GPIOD_LINE_REQUEST_EVENT_FALLING_EDGE, /**< Monitor both types of events. */ - GPIOD_REQUEST_EVENT_RISING_EDGE, + GPIOD_LINE_REQUEST_EVENT_RISING_EDGE, /**< Only watch rising edge events. */ - GPIOD_REQUEST_EVENT_BOTH_EDGES, + GPIOD_LINE_REQUEST_EVENT_BOTH_EDGES, /**< Only watch falling edge events. */ }; @@ -390,11 +390,11 @@ enum { * @brief Miscellaneous GPIO flags. */ enum { - GPIOD_REQUEST_OPEN_DRAIN = GPIOD_BIT(0), + GPIOD_LINE_REQUEST_OPEN_DRAIN = GPIOD_BIT(0), /**< The line is an open-drain port. */ - GPIOD_REQUEST_OPEN_SOURCE = GPIOD_BIT(1), + GPIOD_LINE_REQUEST_OPEN_SOURCE = GPIOD_BIT(1), /**< The line is an open-source port. */ - GPIOD_REQUEST_ACTIVE_LOW = GPIOD_BIT(2), + GPIOD_LINE_REQUEST_ACTIVE_LOW = GPIOD_BIT(2), /**< The active state of the line is low (high is the default). */ }; @@ -402,9 +402,9 @@ enum { * @brief Possible direction settings. */ enum { - GPIOD_DIRECTION_INPUT, + GPIOD_LINE_DIRECTION_INPUT, /**< Direction is input - we're reading the state of a GPIO line. */ - GPIOD_DIRECTION_OUTPUT, + GPIOD_LINE_DIRECTION_OUTPUT, /**< Direction is output - we're driving the GPIO line. */ }; @@ -412,9 +412,9 @@ enum { * @brief Possible active state settings. */ enum { - GPIOD_ACTIVE_STATE_HIGH, + GPIOD_LINE_ACTIVE_STATE_HIGH, /**< The active state of a GPIO is active-high. */ - GPIOD_ACTIVE_STATE_LOW, + GPIOD_LINE_ACTIVE_STATE_LOW, /**< The active state of a GPIO is active-low. */ }; @@ -941,9 +941,9 @@ struct gpiod_chip * gpiod_line_get_chip(struct gpiod_line *line) GPIOD_API; * @brief Event types. */ enum { - GPIOD_EVENT_RISING_EDGE, + GPIOD_LINE_EVENT_RISING_EDGE, /**< Rising edge event. */ - GPIOD_EVENT_FALLING_EDGE, + GPIOD_LINE_EVENT_FALLING_EDGE, /**< Falling edge event. */ }; diff --git a/src/lib/core.c b/src/lib/core.c index eabee89..e0bba4c 100644 --- a/src/lib/core.c +++ b/src/lib/core.c @@ -330,15 +330,16 @@ const char * gpiod_line_consumer(struct gpiod_line *line) int gpiod_line_direction(struct gpiod_line *line) { - return line->info.flags & GPIOLINE_FLAG_IS_OUT ? GPIOD_DIRECTION_OUTPUT - : GPIOD_DIRECTION_INPUT; + return line->info.flags & GPIOLINE_FLAG_IS_OUT + ? GPIOD_LINE_DIRECTION_OUTPUT + : GPIOD_LINE_DIRECTION_INPUT; } int gpiod_line_active_state(struct gpiod_line *line) { return line->info.flags & GPIOLINE_FLAG_ACTIVE_LOW - ? GPIOD_ACTIVE_STATE_LOW - : GPIOD_ACTIVE_STATE_HIGH; + ? GPIOD_LINE_ACTIVE_STATE_LOW + : GPIOD_LINE_ACTIVE_STATE_HIGH; } bool gpiod_line_is_used(struct gpiod_line *line) @@ -452,23 +453,23 @@ static int line_request_values(struct gpiod_line_bulk *bulk, req = &handle->request; - if (config->flags & GPIOD_REQUEST_OPEN_DRAIN) + if (config->flags & GPIOD_LINE_REQUEST_OPEN_DRAIN) req->flags |= GPIOHANDLE_REQUEST_OPEN_DRAIN; - if (config->flags & GPIOD_REQUEST_OPEN_SOURCE) + if (config->flags & GPIOD_LINE_REQUEST_OPEN_SOURCE) req->flags |= GPIOHANDLE_REQUEST_OPEN_SOURCE; - if (config->flags & GPIOD_REQUEST_ACTIVE_LOW) + if (config->flags & GPIOD_LINE_REQUEST_ACTIVE_LOW) req->flags |= GPIOHANDLE_REQUEST_ACTIVE_LOW; - if (config->request_type == GPIOD_REQUEST_DIRECTION_INPUT) + if (config->request_type == GPIOD_LINE_REQUEST_DIRECTION_INPUT) req->flags |= GPIOHANDLE_REQUEST_INPUT; - else if (config->request_type == GPIOD_REQUEST_DIRECTION_OUTPUT) + else if (config->request_type == GPIOD_LINE_REQUEST_DIRECTION_OUTPUT) req->flags |= GPIOHANDLE_REQUEST_OUTPUT; req->lines = bulk->num_lines; for (i = 0; i < bulk->num_lines; i++) { req->lineoffsets[i] = gpiod_line_offset(bulk->lines[i]); - if (config->request_type == GPIOD_REQUEST_DIRECTION_OUTPUT) + if (config->request_type == GPIOD_LINE_REQUEST_DIRECTION_OUTPUT) req->default_values[i] = !!default_vals[i]; } @@ -510,18 +511,18 @@ static int line_request_event_single(struct gpiod_line *line, req->lineoffset = gpiod_line_offset(line); req->handleflags |= GPIOHANDLE_REQUEST_INPUT; - if (config->flags & GPIOD_REQUEST_OPEN_DRAIN) + if (config->flags & GPIOD_LINE_REQUEST_OPEN_DRAIN) req->handleflags |= GPIOHANDLE_REQUEST_OPEN_DRAIN; - if (config->flags & GPIOD_REQUEST_OPEN_SOURCE) + if (config->flags & GPIOD_LINE_REQUEST_OPEN_SOURCE) req->handleflags |= GPIOHANDLE_REQUEST_OPEN_SOURCE; - if (config->flags & GPIOD_REQUEST_ACTIVE_LOW) + if (config->flags & GPIOD_LINE_REQUEST_ACTIVE_LOW) req->handleflags |= GPIOHANDLE_REQUEST_ACTIVE_LOW; - if (config->request_type == GPIOD_REQUEST_EVENT_RISING_EDGE) + if (config->request_type == GPIOD_LINE_REQUEST_EVENT_RISING_EDGE) req->eventflags |= GPIOEVENT_REQUEST_RISING_EDGE; - else if (config->request_type == GPIOD_REQUEST_EVENT_FALLING_EDGE) + else if (config->request_type == GPIOD_LINE_REQUEST_EVENT_FALLING_EDGE) req->eventflags |= GPIOEVENT_REQUEST_FALLING_EDGE; - else if (config->request_type == GPIOD_REQUEST_EVENT_BOTH_EDGES) + else if (config->request_type == GPIOD_LINE_REQUEST_EVENT_BOTH_EDGES) req->eventflags |= GPIOEVENT_REQUEST_BOTH_EDGES; rv = ioctl(line->chip->fd, GPIO_GET_LINEEVENT_IOCTL, req); @@ -568,7 +569,7 @@ int gpiod_line_request_input(struct gpiod_line *line, const char *consumer) { struct gpiod_line_request_config config = { .consumer = consumer, - .request_type = GPIOD_REQUEST_DIRECTION_INPUT, + .request_type = GPIOD_LINE_REQUEST_DIRECTION_INPUT, }; return gpiod_line_request(line, &config, 0); @@ -579,7 +580,7 @@ int gpiod_line_request_output(struct gpiod_line *line, { struct gpiod_line_request_config config = { .consumer = consumer, - .request_type = GPIOD_REQUEST_DIRECTION_OUTPUT, + .request_type = GPIOD_LINE_REQUEST_DIRECTION_OUTPUT, }; return gpiod_line_request(line, &config, default_val); @@ -590,7 +591,7 @@ int gpiod_line_request_input_flags(struct gpiod_line *line, { struct gpiod_line_request_config config = { .consumer = consumer, - .request_type = GPIOD_REQUEST_DIRECTION_INPUT, + .request_type = GPIOD_LINE_REQUEST_DIRECTION_INPUT, .flags = flags, }; @@ -603,7 +604,7 @@ int gpiod_line_request_output_flags(struct gpiod_line *line, { struct gpiod_line_request_config config = { .consumer = consumer, - .request_type = GPIOD_REQUEST_DIRECTION_OUTPUT, + .request_type = GPIOD_LINE_REQUEST_DIRECTION_OUTPUT, .flags = flags, }; @@ -626,21 +627,21 @@ int gpiod_line_request_rising_edge_events(struct gpiod_line *line, const char *consumer) { return line_event_request_type(line, consumer, 0, - GPIOD_REQUEST_EVENT_RISING_EDGE); + GPIOD_LINE_REQUEST_EVENT_RISING_EDGE); } int gpiod_line_request_falling_edge_events(struct gpiod_line *line, const char *consumer) { return line_event_request_type(line, consumer, 0, - GPIOD_REQUEST_EVENT_FALLING_EDGE); + GPIOD_LINE_REQUEST_EVENT_FALLING_EDGE); } int gpiod_line_request_both_edges_events(struct gpiod_line *line, const char *consumer) { return line_event_request_type(line, consumer, 0, - GPIOD_REQUEST_EVENT_BOTH_EDGES); + GPIOD_LINE_REQUEST_EVENT_BOTH_EDGES); } int gpiod_line_request_rising_edge_events_flags(struct gpiod_line *line, @@ -648,7 +649,7 @@ int gpiod_line_request_rising_edge_events_flags(struct gpiod_line *line, int flags) { return line_event_request_type(line, consumer, flags, - GPIOD_REQUEST_EVENT_RISING_EDGE); + GPIOD_LINE_REQUEST_EVENT_RISING_EDGE); } int gpiod_line_request_falling_edge_events_flags(struct gpiod_line *line, @@ -656,28 +657,28 @@ int gpiod_line_request_falling_edge_events_flags(struct gpiod_line *line, int flags) { return line_event_request_type(line, consumer, flags, - GPIOD_REQUEST_EVENT_FALLING_EDGE); + GPIOD_LINE_REQUEST_EVENT_FALLING_EDGE); } int gpiod_line_request_both_edges_events_flags(struct gpiod_line *line, const char *consumer, int flags) { return line_event_request_type(line, consumer, flags, - GPIOD_REQUEST_EVENT_BOTH_EDGES); + GPIOD_LINE_REQUEST_EVENT_BOTH_EDGES); } static bool line_request_is_direction(int request) { - return request == GPIOD_REQUEST_DIRECTION_AS_IS - || request == GPIOD_REQUEST_DIRECTION_INPUT - || request == GPIOD_REQUEST_DIRECTION_OUTPUT; + return request == GPIOD_LINE_REQUEST_DIRECTION_AS_IS + || request == GPIOD_LINE_REQUEST_DIRECTION_INPUT + || request == GPIOD_LINE_REQUEST_DIRECTION_OUTPUT; } static bool line_request_is_events(int request) { - return request == GPIOD_REQUEST_EVENT_FALLING_EDGE - || request == GPIOD_REQUEST_EVENT_RISING_EDGE - || request == GPIOD_REQUEST_EVENT_BOTH_EDGES; + return request == GPIOD_LINE_REQUEST_EVENT_FALLING_EDGE + || request == GPIOD_LINE_REQUEST_EVENT_RISING_EDGE + || request == GPIOD_LINE_REQUEST_EVENT_BOTH_EDGES; } int gpiod_line_request_bulk(struct gpiod_line_bulk *bulk, @@ -702,7 +703,7 @@ int gpiod_line_request_bulk_input(struct gpiod_line_bulk *bulk, { struct gpiod_line_request_config config = { .consumer = consumer, - .request_type = GPIOD_REQUEST_DIRECTION_INPUT, + .request_type = GPIOD_LINE_REQUEST_DIRECTION_INPUT, }; return gpiod_line_request_bulk(bulk, &config, 0); @@ -714,7 +715,7 @@ int gpiod_line_request_bulk_output(struct gpiod_line_bulk *bulk, { struct gpiod_line_request_config config = { .consumer = consumer, - .request_type = GPIOD_REQUEST_DIRECTION_OUTPUT, + .request_type = GPIOD_LINE_REQUEST_DIRECTION_OUTPUT, }; return gpiod_line_request_bulk(bulk, &config, default_vals); @@ -737,21 +738,21 @@ int gpiod_line_request_bulk_rising_edge_events(struct gpiod_line_bulk *bulk, const char *consumer) { return line_event_request_type_bulk(bulk, consumer, 0, - GPIOD_REQUEST_EVENT_RISING_EDGE); + GPIOD_LINE_REQUEST_EVENT_RISING_EDGE); } int gpiod_line_request_bulk_falling_edge_events(struct gpiod_line_bulk *bulk, const char *consumer) { return line_event_request_type_bulk(bulk, consumer, 0, - GPIOD_REQUEST_EVENT_FALLING_EDGE); + GPIOD_LINE_REQUEST_EVENT_FALLING_EDGE); } int gpiod_line_request_bulk_both_edges_events(struct gpiod_line_bulk *bulk, const char *consumer) { return line_event_request_type_bulk(bulk, consumer, 0, - GPIOD_REQUEST_EVENT_BOTH_EDGES); + GPIOD_LINE_REQUEST_EVENT_BOTH_EDGES); } int gpiod_line_request_bulk_input_flags(struct gpiod_line_bulk *bulk, @@ -759,7 +760,7 @@ int gpiod_line_request_bulk_input_flags(struct gpiod_line_bulk *bulk, { struct gpiod_line_request_config config = { .consumer = consumer, - .request_type = GPIOD_REQUEST_DIRECTION_INPUT, + .request_type = GPIOD_LINE_REQUEST_DIRECTION_INPUT, .flags = flags, }; @@ -772,7 +773,7 @@ int gpiod_line_request_bulk_output_flags(struct gpiod_line_bulk *bulk, { struct gpiod_line_request_config config = { .consumer = consumer, - .request_type = GPIOD_REQUEST_DIRECTION_OUTPUT, + .request_type = GPIOD_LINE_REQUEST_DIRECTION_OUTPUT, .flags = flags, }; @@ -784,7 +785,7 @@ int gpiod_line_request_bulk_rising_edge_events_flags( const char *consumer, int flags) { return line_event_request_type_bulk(bulk, consumer, flags, - GPIOD_REQUEST_EVENT_RISING_EDGE); + GPIOD_LINE_REQUEST_EVENT_RISING_EDGE); } int gpiod_line_request_bulk_falling_edge_events_flags( @@ -792,7 +793,7 @@ int gpiod_line_request_bulk_falling_edge_events_flags( const char *consumer, int flags) { return line_event_request_type_bulk(bulk, consumer, flags, - GPIOD_REQUEST_EVENT_FALLING_EDGE); + GPIOD_LINE_REQUEST_EVENT_FALLING_EDGE); } int gpiod_line_request_bulk_both_edges_events_flags( @@ -800,7 +801,7 @@ int gpiod_line_request_bulk_both_edges_events_flags( const char *consumer, int flags) { return line_event_request_type_bulk(bulk, consumer, flags, - GPIOD_REQUEST_EVENT_BOTH_EDGES); + GPIOD_LINE_REQUEST_EVENT_BOTH_EDGES); } void gpiod_line_release(struct gpiod_line *line) @@ -1052,8 +1053,8 @@ int gpiod_line_event_read_fd(int fd, struct gpiod_line_event *event) } event->event_type = evdata.id == GPIOEVENT_EVENT_RISING_EDGE - ? GPIOD_EVENT_RISING_EDGE - : GPIOD_EVENT_FALLING_EDGE; + ? GPIOD_LINE_EVENT_RISING_EDGE + : GPIOD_LINE_EVENT_FALLING_EDGE; event->ts.tv_sec = evdata.timestamp / 1000000000ULL; event->ts.tv_nsec = evdata.timestamp % 1000000000ULL; diff --git a/src/lib/simple.c b/src/lib/simple.c index ddbba03..cb53674 100644 --- a/src/lib/simple.c +++ b/src/lib/simple.c @@ -61,7 +61,7 @@ int gpiod_simple_get_value_multiple(const char *consumer, const char *device, gpiod_line_bulk_add(&bulk, line); } - flags = active_low ? GPIOD_REQUEST_ACTIVE_LOW : 0; + flags = active_low ? GPIOD_LINE_REQUEST_ACTIVE_LOW : 0; status = gpiod_line_request_bulk_input_flags(&bulk, consumer, flags); if (status < 0) { @@ -119,7 +119,7 @@ int gpiod_simple_set_value_multiple(const char *consumer, const char *device, gpiod_line_bulk_add(&bulk, line); } - flags = active_low ? GPIOD_REQUEST_ACTIVE_LOW : 0; + flags = active_low ? GPIOD_LINE_REQUEST_ACTIVE_LOW : 0; status = gpiod_line_request_bulk_output_flags(&bulk, consumer, flags, values); @@ -220,7 +220,7 @@ int gpiod_simple_event_loop_multiple(const char *consumer, const char *device, gpiod_line_bulk_add(&bulk, line); } - flags = active_low ? GPIOD_REQUEST_ACTIVE_LOW : 0; + flags = active_low ? GPIOD_LINE_REQUEST_ACTIVE_LOW : 0; ret = gpiod_line_request_bulk_both_edges_events_flags(&bulk, consumer, flags); @@ -250,9 +250,10 @@ int gpiod_simple_event_loop_multiple(const char *consumer, const char *device, if (ret < 0) goto out; - evtype = event.event_type == GPIOD_EVENT_RISING_EDGE - ? GPIOD_SIMPLE_EVENT_CB_RISING_EDGE - : GPIOD_SIMPLE_EVENT_CB_FALLING_EDGE; + if (event.event_type == GPIOD_LINE_EVENT_RISING_EDGE) + evtype = GPIOD_SIMPLE_EVENT_CB_RISING_EDGE; + else + evtype = GPIOD_SIMPLE_EVENT_CB_FALLING_EDGE; line_offset = offsets[event_offset]; } diff --git a/src/tools/gpioinfo.c b/src/tools/gpioinfo.c index 0ae9f72..9d83d59 100644 --- a/src/tools/gpioinfo.c +++ b/src/tools/gpioinfo.c @@ -124,12 +124,12 @@ static void list_lines(struct gpiod_chip *chip) : prinfo(&of, 12, "unused"); printf(" "); - prinfo(&of, 8, "%s ", direction == GPIOD_DIRECTION_INPUT - ? "input" : "output"); + prinfo(&of, 8, "%s ", direction == GPIOD_LINE_DIRECTION_INPUT + ? "input" : "output"); prinfo(&of, 13, "%s ", - active_state == GPIOD_ACTIVE_STATE_LOW - ? "active-low" - : "active-high"); + active_state == GPIOD_LINE_ACTIVE_STATE_LOW + ? "active-low" + : "active-high"); flag_printed = false; for (i = 0; i < ARRAY_SIZE(flags); i++) { diff --git a/tests/tests-event.c b/tests/tests-event.c index 1406c19..fb14319 100644 --- a/tests/tests-event.c +++ b/tests/tests-event.c @@ -37,7 +37,7 @@ static void event_rising_edge_good(void) rv = gpiod_line_event_read(line, &ev); TEST_ASSERT_RET_OK(rv); - TEST_ASSERT_EQ(ev.event_type, GPIOD_EVENT_RISING_EDGE); + TEST_ASSERT_EQ(ev.event_type, GPIOD_LINE_EVENT_RISING_EDGE); } TEST_DEFINE(event_rising_edge_good, "events - receive single rising edge event", @@ -68,7 +68,7 @@ static void event_falling_edge_good(void) rv = gpiod_line_event_read(line, &ev); TEST_ASSERT_RET_OK(rv); - TEST_ASSERT_EQ(ev.event_type, GPIOD_EVENT_FALLING_EDGE); + TEST_ASSERT_EQ(ev.event_type, GPIOD_LINE_EVENT_FALLING_EDGE); } TEST_DEFINE(event_falling_edge_good, "events - receive single falling edge event", @@ -114,7 +114,7 @@ static void event_rising_edge_active_low(void) TEST_ASSERT_NOT_NULL(line); rv = gpiod_line_request_rising_edge_events_flags(line, TEST_CONSUMER, - GPIOD_REQUEST_ACTIVE_LOW); + GPIOD_LINE_REQUEST_ACTIVE_LOW); TEST_ASSERT_RET_OK(rv); test_set_event(0, 7, TEST_EVENT_RISING, 100); @@ -125,7 +125,7 @@ static void event_rising_edge_active_low(void) rv = gpiod_line_event_read(line, &ev); TEST_ASSERT_RET_OK(rv); - TEST_ASSERT_EQ(ev.event_type, GPIOD_EVENT_RISING_EDGE); + TEST_ASSERT_EQ(ev.event_type, GPIOD_LINE_EVENT_RISING_EDGE); } TEST_DEFINE(event_rising_edge_active_low, "events - single rising edge event with low active state", @@ -159,7 +159,7 @@ static void event_get_value(void) rv = gpiod_line_event_read(line, &ev); TEST_ASSERT_RET_OK(rv); - TEST_ASSERT_EQ(ev.event_type, GPIOD_EVENT_RISING_EDGE); + TEST_ASSERT_EQ(ev.event_type, GPIOD_LINE_EVENT_RISING_EDGE); rv = gpiod_line_get_value(line); TEST_ASSERT_EQ(rv, 1); diff --git a/tests/tests-gpioinfo.c b/tests/tests-gpioinfo.c index adfeb40..c75cbb2 100644 --- a/tests/tests-gpioinfo.c +++ b/tests/tests-gpioinfo.c @@ -52,7 +52,7 @@ static void gpioinfo_dump_all_chips_one_exported(void) TEST_ASSERT_NOT_NULL(line); rv = gpiod_line_request_input_flags(line, TEST_CONSUMER, - GPIOD_REQUEST_ACTIVE_LOW); + GPIOD_LINE_REQUEST_ACTIVE_LOW); TEST_ASSERT_RET_OK(rv); test_tool_run("gpioinfo", (char *)NULL); diff --git a/tests/tests-line.c b/tests/tests-line.c index 41b78fd..b238c9b 100644 --- a/tests/tests-line.c +++ b/tests/tests-line.c @@ -241,8 +241,8 @@ static void line_request_bulk_different_chips(void) gpiod_line_bulk_add(&bulk, lineB1); req.consumer = TEST_CONSUMER; - req.request_type = GPIOD_REQUEST_DIRECTION_INPUT; - req.flags = GPIOD_ACTIVE_STATE_HIGH; + req.request_type = GPIOD_LINE_REQUEST_DIRECTION_INPUT; + req.flags = GPIOD_LINE_ACTIVE_STATE_HIGH; status = gpiod_line_request_bulk(&bulk, &req, NULL); TEST_ASSERT_NOTEQ(status, 0); @@ -342,14 +342,14 @@ static void line_direction(void) status = gpiod_line_request_output(line, TEST_CONSUMER, 0); TEST_ASSERT_RET_OK(status); - TEST_ASSERT_EQ(gpiod_line_direction(line), GPIOD_DIRECTION_OUTPUT); + TEST_ASSERT_EQ(gpiod_line_direction(line), GPIOD_LINE_DIRECTION_OUTPUT); gpiod_line_release(line); status = gpiod_line_request_input(line, TEST_CONSUMER); TEST_ASSERT_RET_OK(status); - TEST_ASSERT_EQ(gpiod_line_direction(line), GPIOD_DIRECTION_INPUT); + TEST_ASSERT_EQ(gpiod_line_direction(line), GPIOD_LINE_DIRECTION_INPUT); } TEST_DEFINE(line_direction, "gpiod_line_direction() - set & get", @@ -370,15 +370,16 @@ static void line_active_state(void) status = gpiod_line_request_input(line, TEST_CONSUMER); TEST_ASSERT_RET_OK(status); - TEST_ASSERT_EQ(gpiod_line_active_state(line), GPIOD_ACTIVE_STATE_HIGH); + TEST_ASSERT_EQ(gpiod_line_active_state(line), + GPIOD_LINE_ACTIVE_STATE_HIGH); gpiod_line_release(line); status = gpiod_line_request_input_flags(line, TEST_CONSUMER, - GPIOD_REQUEST_ACTIVE_LOW); + GPIOD_LINE_REQUEST_ACTIVE_LOW); TEST_ASSERT_RET_OK(status); - TEST_ASSERT_EQ(gpiod_line_direction(line), GPIOD_DIRECTION_INPUT); + TEST_ASSERT_EQ(gpiod_line_direction(line), GPIOD_LINE_DIRECTION_INPUT); } TEST_DEFINE(line_active_state, "gpiod_line_active_state() - set & get", @@ -401,9 +402,9 @@ static void line_misc_flags(void) TEST_ASSERT_FALSE(gpiod_line_is_open_drain(line)); TEST_ASSERT_FALSE(gpiod_line_is_open_source(line)); - config.request_type = GPIOD_REQUEST_DIRECTION_INPUT; + config.request_type = GPIOD_LINE_REQUEST_DIRECTION_INPUT; config.consumer = TEST_CONSUMER; - config.flags = GPIOD_REQUEST_OPEN_DRAIN; + config.flags = GPIOD_LINE_REQUEST_OPEN_DRAIN; status = gpiod_line_request(line, &config, 0); TEST_ASSERT_RET_OK(status); @@ -414,7 +415,7 @@ static void line_misc_flags(void) gpiod_line_release(line); - config.flags = GPIOD_REQUEST_OPEN_SOURCE; + config.flags = GPIOD_LINE_REQUEST_OPEN_SOURCE; status = gpiod_line_request(line, &config, 0); TEST_ASSERT_RET_OK(status); @@ -440,7 +441,7 @@ static void line_null_consumer(void) line = gpiod_chip_get_line(chip, 2); TEST_ASSERT_NOT_NULL(line); - config.request_type = GPIOD_REQUEST_DIRECTION_INPUT; + config.request_type = GPIOD_LINE_REQUEST_DIRECTION_INPUT; config.consumer = NULL; config.flags = 0; @@ -454,7 +455,7 @@ static void line_null_consumer(void) * Internally we use different structures for event requests, so we * need to test that explicitly too. */ - config.request_type = GPIOD_REQUEST_EVENT_BOTH_EDGES; + config.request_type = GPIOD_LINE_REQUEST_EVENT_BOTH_EDGES; rv = gpiod_line_request(line, &config, 0); TEST_ASSERT_RET_OK(rv); @@ -477,7 +478,7 @@ static void line_empty_consumer(void) line = gpiod_chip_get_line(chip, 2); TEST_ASSERT_NOT_NULL(line); - config.request_type = GPIOD_REQUEST_DIRECTION_INPUT; + config.request_type = GPIOD_LINE_REQUEST_DIRECTION_INPUT; config.consumer = ""; config.flags = 0; @@ -491,7 +492,7 @@ static void line_empty_consumer(void) * Internally we use different structures for event requests, so we * need to test that explicitly too. */ - config.request_type = GPIOD_REQUEST_EVENT_BOTH_EDGES; + config.request_type = GPIOD_LINE_REQUEST_EVENT_BOTH_EDGES; rv = gpiod_line_request(line, &config, 0); TEST_ASSERT_RET_OK(rv);