Top |
This section defines the methods that allow the user to run barebox specific operations over the RATP link.
ratp_status_t ratp_barebox_link_ping (ratp_link_t *ratp
,unsigned long timeout_ms
);
Sends a PING to barebox and waits for the PONG as return.
ratp |
a ratp_link_t. |
[in][not nullable] |
timeout_ms |
maximum time, in milliseconds, to wait for the operation to finish, or 0 to wait forever. |
[in] |
ratp_status_t ratp_barebox_link_command (ratp_link_t *ratp
,unsigned long timeout_ms
,const char *command
,uint32_t *out_errno_result
,char **out_stdout_result
);
Sends a command to barebox and waits for it to finish. Both the command result and the standard output it generated are returned.
ratp |
a ratp_link_t. |
[in][not nullable] |
timeout_ms |
maximum time, in milliseconds, to wait for the operation to finish, or 0 to wait forever. |
[in] |
command |
command to send, in ASCII. |
[in][not nullable] |
out_errno_result |
output location to store the errno result returned. |
[out][optional] |
out_stdout_result |
output location to store the resulting stdout output. |
[out callee-allocates][optional] |
ratp_status_t ratp_barebox_link_getenv (ratp_link_t *ratp
,unsigned long timeout_ms
,const char *env_name
,char **env_value
);
Reads the contents of a given environment variable in the remote barebox instance.
ratp |
a ratp_link_t. |
[in][not nullable] |
timeout_ms |
maximum time, in milliseconds, to wait for the operation to finish, or 0 to wait forever. |
[in] |
env_name |
name of the environment variable to read. |
[in] |
env_value |
output location to store the value of the environment variable. |
[out callee-allocates][optional] |
ratp_status_t ratp_barebox_link_md (ratp_link_t *ratp
,unsigned long timeout_ms
,const char *path
,uint16_t addr
,uint16_t size
,uint8_t **out
,uint16_t *out_size
);
Memory display.
Reads size
bytes of memory from the file at path
, starting at addr
.
If RATP_STATUS_OK
is returned, out
and out_size
will be set.
ratp |
a ratp_link_t. |
[in][not nullable] |
timeout_ms |
maximum time, in milliseconds, to wait for the operation to finish, or 0 to wait forever. |
[in] |
path |
path to the display file, or |
[in][nullable] |
addr |
address where to start reading from. |
[in] |
size |
amount of bytes to read. |
[in] |
out |
output location to store the data read. |
[out callee-allocates][array length=out_size][optional] |
out_size |
size of the data read in |
[out][optional] |
ratp_status_t ratp_barebox_link_mw (ratp_link_t *ratp
,unsigned long timeout_ms
,const char *path
,uint16_t addr
,const uint8_t *data
,uint16_t data_size
,uint16_t *out_written
);
Memory write.
Writes data_size
bytes into the display file at path
, starting at addr
.
If RATP_STATUS_OK
is returned, out_written
will be set.
ratp |
a ratp_link_t. |
[in][not nullable] |
timeout_ms |
maximum time, in milliseconds, to wait for the operation (in): finish, or 0 to wait forever. |
[in] |
path |
path to the display file, or |
[in][nullable] |
addr |
address where to start writing to. |
[in] |
data |
data to write. |
[in][array length=data_size][not nullable] |
data_size |
amount of bytes to write. |
[in] |
out_written |
number of bytes successfully written. |
[out][optional] |
ratp_status_t ratp_barebox_link_i2c_read (ratp_link_t *ratp
,unsigned long timeout_ms
,uint8_t bus
,uint8_t addr
,uint16_t reg
,ratp_barebox_link_i2c_flag_t flags
,uint16_t size
,uint8_t **out
,uint16_t *out_size
);
i2c read.
Reads size
bytes from device at bus
/addr
.
If RATP_STATUS_OK
is returned, out
and out_size
will be set.
ratp |
a ratp_link_t. |
[in][not nullable] |
timeout_ms |
maximum time, in milliseconds, to wait for the operation to finish, or 0 to wait forever. |
[in] |
bus |
bus number. |
[in] |
addr |
device address. |
[in] |
reg |
start register. |
[in] |
flags |
a bitmask of ratp_barebox_link_i2c_flag_t values. |
[in] |
size |
amount of bytes to read. |
[in] |
out |
output location to store the data read. |
[out callee-allocates][array length=out_size][optional] |
out_size |
size of the data read in |
[out][optional] |
ratp_status_t ratp_barebox_link_i2c_write (ratp_link_t *ratp
,unsigned long timeout_ms
,uint8_t bus
,uint8_t addr
,uint16_t reg
,ratp_barebox_link_i2c_flag_t flags
,const uint8_t *data
,uint16_t data_size
,uint16_t *out_written
);
i2c write.
Writes data_size
bytes to the device at bus
/addr
.
If RATP_STATUS_OK
is returned, out_written
will be set.
ratp |
a ratp_link_t. |
[in][not nullable] |
timeout_ms |
maximum time, in milliseconds, to wait for the operation to finish, or 0 to wait forever. |
[in] |
bus |
bus number. |
[in] |
addr |
device address. |
[in] |
reg |
optional start register, set to 0xffff to ignore. |
[in] |
flags |
a bitmask of ratp_barebox_link_i2c_flag_t values. |
[in] |
data |
data to write. |
[in][array length=data_size][not nullable] |
data_size |
amount of bytes to write. |
[in] |
out_written |
number of bytes successfully written. |
[out][optional] |
ratp_status_t ratp_barebox_link_gpio_get_value (ratp_link_t *ratp
,unsigned long timeout_ms
,uint32_t gpio
,bool *value
);
Gets the current value of the input GPIO gpio
.
This method should only be used with GPIOs configured as
RATP_BAREBOX_LINK_GPIO_DIRECTION_INPUT
.
ratp |
a ratp_link_t. |
[in][not nullable] |
timeout_ms |
maximum time, in milliseconds, to wait for the operation to finish, or 0 to wait forever. |
[in] |
gpio |
a GPIO number. |
[in] |
value |
output location to store the value. |
[out][optional] |
ratp_status_t ratp_barebox_link_gpio_set_value (ratp_link_t *ratp
,unsigned long timeout_ms
,uint32_t gpio
,bool value
);
Sets the current value of the output GPIO gpio
.
This method should only be used with GPIOs configured as
RATP_BAREBOX_LINK_GPIO_DIRECTION_OUTPUT
.
ratp |
a ratp_link_t. |
[in][not nullable] |
timeout_ms |
maximum time, in milliseconds, to wait for the operation to finish, or 0 to wait forever. |
[in] |
gpio |
a GPIO number. |
[in] |
value |
the value to set. |
[in] |
ratp_status_t ratp_barebox_link_gpio_set_direction (ratp_link_t *ratp
,unsigned long timeout_ms
,uint32_t gpio
,ratp_barebox_link_gpio_direction_t direction
,bool value
);
Sets the direction of the GPIO gpio
.
ratp |
a ratp_link_t. |
[in][not nullable] |
timeout_ms |
maximum time, in milliseconds, to wait for the operation to finish, or 0 to wait forever. |
[in] |
gpio |
a GPIO number. |
[in] |
direction |
[in] | |
value |
if |
[in] |
ratp_status_t ratp_barebox_link_reset (ratp_link_t *ratp
,bool force
);
Performs a reset in barebox.
Note that this operation will make the RATP session abort.