OpenOCD
|
File I/O functions. More...
Go to the source code of this file.
Functions | |
JAYLINK_API int | jaylink_file_delete (struct jaylink_device_handle *devh, const char *filename) |
Delete a file. More... | |
JAYLINK_API int | jaylink_file_get_size (struct jaylink_device_handle *devh, const char *filename, uint32_t *size) |
Retrieve the size of a file. More... | |
JAYLINK_API int | jaylink_file_read (struct jaylink_device_handle *devh, const char *filename, uint8_t *buffer, uint32_t offset, uint32_t *length) |
Read from a file. More... | |
JAYLINK_API int | jaylink_file_write (struct jaylink_device_handle *devh, const char *filename, const uint8_t *buffer, uint32_t offset, uint32_t *length) |
Write to a file. More... | |
File I/O functions.
Definition in file jtag/drivers/libjaylink/libjaylink/fileio.c.
JAYLINK_API int jaylink_file_delete | ( | struct jaylink_device_handle * | devh, |
const char * | filename | ||
) |
Delete a file.
[in,out] | devh | Device handle. |
[in] | filename | Name of the file to delete. The length of the name must not exceed JAYLINK_FILE_NAME_MAX_LENGTH bytes. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR_DEV | Unspecified device error, or the file was not found. |
JAYLINK_ERR | Other error conditions. |
Definition at line 430 of file jtag/drivers/libjaylink/libjaylink/fileio.c.
References buffer_get_u32(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_ERR_DEV, JAYLINK_FILE_NAME_MAX_LENGTH, JAYLINK_OK, jaylink_strerror(), length, log_err(), transport_read(), transport_start_read(), transport_start_write(), and transport_write().
JAYLINK_API int jaylink_file_get_size | ( | struct jaylink_device_handle * | devh, |
const char * | filename, | ||
uint32_t * | size | ||
) |
Retrieve the size of a file.
[in,out] | devh | Device handle. |
[in] | filename | Name of the file to retrieve the size of. The length of the name must not exceed JAYLINK_FILE_NAME_MAX_LENGTH bytes. |
[out] | size | Size of the file in bytes on success, and undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR_DEV | Unspecified device error, or the file was not found. |
JAYLINK_ERR | Other error conditions. |
Definition at line 338 of file jtag/drivers/libjaylink/libjaylink/fileio.c.
References buffer_get_u32(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_ERR_DEV, JAYLINK_FILE_NAME_MAX_LENGTH, JAYLINK_OK, jaylink_strerror(), length, log_err(), transport_read(), transport_start_read(), transport_start_write(), and transport_write().
JAYLINK_API int jaylink_file_read | ( | struct jaylink_device_handle * | devh, |
const char * | filename, | ||
uint8_t * | buffer, | ||
uint32_t | offset, | ||
uint32_t * | length | ||
) |
Read from a file.
The maximum amount of data that can be read from a file at once is JAYLINK_FILE_MAX_TRANSFER_SIZE bytes. Multiple reads in conjunction with the offset
parameter are needed for larger files.
[in,out] | devh | Device handle. |
[in] | filename | Name of the file to read from. The length of the name must not exceed JAYLINK_FILE_NAME_MAX_LENGTH bytes. |
[out] | buffer | Buffer to store read data on success. Its content is undefined on failure |
[in] | offset | Offset in bytes relative to the beginning of the file from where to start reading. |
[in,out] | length | Number of bytes to read. On success, the value gets updated with the actual number of bytes read. The value is undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR_DEV | Unspecified device error, or the file was not found. |
JAYLINK_ERR | Other error conditions. |
Definition at line 77 of file jtag/drivers/libjaylink/libjaylink/fileio.c.
References buffer_get_u32(), buffer_set_u32(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_ERR_DEV, JAYLINK_FILE_MAX_TRANSFER_SIZE, JAYLINK_FILE_NAME_MAX_LENGTH, JAYLINK_OK, jaylink_strerror(), log_err(), transport_read(), transport_start_read(), transport_start_write(), and transport_write().
JAYLINK_API int jaylink_file_write | ( | struct jaylink_device_handle * | devh, |
const char * | filename, | ||
const uint8_t * | buffer, | ||
uint32_t | offset, | ||
uint32_t * | length | ||
) |
Write to a file.
If a file does not exist, a new file is created.
The maximum amount of data that can be written to a file at once is JAYLINK_FILE_MAX_TRANSFER_SIZE bytes. Multiple writes in conjunction with the offset
parameter are needed for larger files.
[in,out] | devh | Device handle. |
[in] | filename | Name of the file to write to. The length of the name must not exceed JAYLINK_FILE_NAME_MAX_LENGTH bytes. |
[in] | buffer | Buffer to write data from. |
[in] | offset | Offset in bytes relative to the beginning of the file from where to start writing. |
[in,out] | length | Number of bytes to write. On success, the value gets updated with the actual number of bytes written. The value is undefined on failure. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_IO | Input/output error. |
JAYLINK_ERR_DEV | Unspecified device error, or the file was not found. |
JAYLINK_ERR | Other error conditions. |
Definition at line 212 of file jtag/drivers/libjaylink/libjaylink/fileio.c.
References buffer_get_u32(), buffer_set_u32(), jaylink_device::ctx, jaylink_device_handle::dev, JAYLINK_ERR_ARG, JAYLINK_ERR_DEV, JAYLINK_FILE_MAX_TRANSFER_SIZE, JAYLINK_FILE_NAME_MAX_LENGTH, JAYLINK_OK, jaylink_strerror(), log_err(), transport_read(), transport_start_read(), transport_start_write(), and transport_write().