}
struct gpiod_line {
- bool requested;
- bool event_requested;
+ bool reserved;
+ bool event_configured;
bool up_to_date;
struct gpiod_chip *chip;
struct gpioline_info info;
line = line_bulk->lines[i];
line->req = req;
- line->requested = true;
+ line->reserved = true;
/*
* Update line info to include the changes after the
* request.
line = line_bulk->lines[i];
line->req = NULL;
- line->requested = false;
+ line->reserved = false;
status = gpiod_line_update(line);
if (status < 0)
}
}
-bool gpiod_line_is_requested(struct gpiod_line *line)
+bool gpiod_line_is_reserved(struct gpiod_line *line)
{
- return line->requested;
+ return line->reserved;
}
static bool line_bulk_is_requested(struct gpiod_line_bulk *line_bulk)
unsigned int i;
for (i = 0; i < line_bulk->num_lines; i++) {
- if (!gpiod_line_is_requested(line_bulk->lines[i]))
+ if (!gpiod_line_is_reserved(line_bulk->lines[i]))
return false;
}
struct gpiod_chip *chip;
int status, fd;
- if (line->event_requested)
+ if (line->event_configured)
return -EBUSY;
req = &line->event;
if (status < 0)
return -1;
- line->event_requested = true;
+ line->event_configured = true;
return 0;
}
void gpiod_line_event_release(struct gpiod_line *line)
{
close(line->event.fd);
- line->event_requested = false;
+ line->event_configured = false;
}
-bool gpiod_line_event_is_requested(struct gpiod_line *line)
+bool gpiod_line_event_configured(struct gpiod_line *line)
{
- return line->event_requested;
+ return line->event_configured;
}
int gpiod_line_event_wait(struct gpiod_line *line,
int gpiod_line_event_get_fd(struct gpiod_line *line)
{
- return line->event_requested ? line->event.fd : -1;
+ return line->event_configured ? line->event.fd : -1;
}
struct gpiod_chip
unsigned int i;
for (i = 0; i < chip->cinfo.lines; i++) {
- if (chip->lines[i].requested)
+ if (chip->lines[i].reserved)
gpiod_line_release(&chip->lines[i]);
}
};
/**
- * @brief Request a single line.
+ * @brief Reserve a single line.
* @param line GPIO line object.
* @param config Request options.
* @param default_val Default line value - only relevant if we're setting
* the direction to output.
- * @return 0 if the line was properly requested. In case of an error this
+ * @return 0 if the line was properly reserved. In case of an error this
* routine returns -1 and sets the last error number.
+ *
+ * Is this routine succeeds, the caller takes posession of the GPIO line until
+ * it's released.
*/
int gpiod_line_request(struct gpiod_line *line,
const struct gpiod_line_request_config *config,
int default_val) GPIOD_API;
/**
- * @brief Request a set of GPIO lines.
- * @param line_bulk Set of GPIO lines to request.
+ * @brief Reserve a set of GPIO lines.
+ * @param line_bulk Set of GPIO lines to reserve.
* @param config Request options.
* @param default_vals Default line values - only relevant if we're setting
* the direction to output.
int *default_vals) GPIOD_API;
/**
- * @brief Release a previously requested line.
+ * @brief Release a previously reserved line.
* @param line GPIO line object.
*/
void gpiod_line_release(struct gpiod_line *line) GPIOD_API;
/**
- * @brief Release a set of previously requested lines.
+ * @brief Release a set of previously reserved lines.
* @param line_bulk Set of GPIO lines to release.
*/
void gpiod_line_release_bulk(struct gpiod_line_bulk *line_bulk) GPIOD_API;
/**
- * @brief Check if the line was requested.
+ * @brief Check if the line is reserved by the calling user.
* @param line GPIO line object.
* @return True if given line was requested, false otherwise.
*/
-bool gpiod_line_is_requested(struct gpiod_line *line) GPIOD_API;
+bool gpiod_line_is_reserved(struct gpiod_line *line) GPIOD_API;
int gpiod_line_get_value(struct gpiod_line *line) GPIOD_API;
void gpiod_line_event_release(struct gpiod_line *line) GPIOD_API;
-bool gpiod_line_event_is_requested(struct gpiod_line *line) GPIOD_API;
+bool gpiod_line_event_configured(struct gpiod_line *line) GPIOD_API;
int gpiod_line_event_wait(struct gpiod_line *line,
const struct timespec *timeout,