|
TT Zephyr Platforms 19.5.0-rc1
Tenstorrent Firmware
|
#include <string.h>#include <tenstorrent/tt_boot_fs.h>#include <zephyr/sys/__assert.h>#include <zephyr/sys/util.h>#include <zephyr/device.h>#include <zephyr/drivers/flash.h>#include <zephyr/devicetree.h>#include <zephyr/logging/log.h>Functions | |
| LOG_MODULE_REGISTER (tt_boot_fs, CONFIG_TT_APP_LOG_LEVEL) | |
| uint32_t | tt_boot_fs_next (uint32_t last_fd_addr) |
| static int | tt_boot_fs_load_cache (tt_boot_fs *tt_boot_fs) |
| int | tt_boot_fs_mount (tt_boot_fs *tt_boot_fs, tt_boot_fs_read hal_read, tt_boot_fs_write hal_write, tt_boot_fs_erase hal_erase) |
| int | tt_boot_fs_add_file (const tt_boot_fs *tt_boot_fs, tt_boot_fs_fd fd, const uint8_t *image_data_src, bool isFailoverEntry, bool isSecurityBinaryEntry) |
| uint32_t | tt_boot_fs_cksum (uint32_t cksum, const uint8_t *data, size_t num_bytes) |
| static tt_checksum_res_t | calculate_and_compare_checksum (uint8_t *data, size_t num_bytes, uint32_t expected, bool skip_checksum) |
| static int | find_fd_by_tag (const tt_boot_fs *tt_boot_fs, const uint8_t *tag, tt_boot_fs_fd *fd_data) |
| int | tt_boot_fs_get_file (const tt_boot_fs *tt_boot_fs, const uint8_t *tag, uint8_t *buf, size_t buf_size, size_t *file_size) |
| int | tt_boot_fs_ls (const struct device *dev, tt_boot_fs_fd *fds, size_t nfds, size_t offset) |
| List file descriptors in boot filesystem. | |
| int | tt_boot_fs_find_fd_by_tag (const struct device *flash_dev, const uint8_t *tag, tt_boot_fs_fd *fd) |
| Find a boot filesystem file descriptor by name on a given flash device. | |
Variables | |
| tt_boot_fs | boot_fs_data |
| static tt_boot_fs_fd | boot_fs_cache [16] |
|
static |
|
static |
| LOG_MODULE_REGISTER | ( | tt_boot_fs | , |
| CONFIG_TT_APP_LOG_LEVEL | ) |
| int tt_boot_fs_add_file | ( | const tt_boot_fs * | tt_boot_fs, |
| tt_boot_fs_fd | fd, | ||
| const uint8_t * | image_data_src, | ||
| bool | isFailoverEntry, | ||
| bool | isSecurityBinaryEntry ) |
| int tt_boot_fs_find_fd_by_tag | ( | const struct device * | flash_dev, |
| const uint8_t * | tag, | ||
| tt_boot_fs_fd * | fd ) |
Find a boot filesystem file descriptor by name on a given flash device.
If fd is NULL, then a return value of 0 indicates that a file named name exists in the boot filesystem residing on flash_dev.
If fd is non-NULL, then file descriptor contents are written to the memory pointed to by it. The output file descriptor includes useful information about the file, like
flash_dev,| flash_dev | flash device containing the boot filesystem | |
| tag | name of the image to search for | |
| [out] | fd | optional pointer to memory where the file descriptor will be written, if found |
| 0 | on success |
| -EIO | if an I/O error occurs |
| -ENXIO | if flash_dev does not contain a boot filesystem |
| -ENOENT | if no file was found matching the specified tag |
| int tt_boot_fs_get_file | ( | const tt_boot_fs * | tt_boot_fs, |
| const uint8_t * | tag, | ||
| uint8_t * | buf, | ||
| size_t | buf_size, | ||
| size_t * | file_size ) |
|
static |
| int tt_boot_fs_ls | ( | const struct device * | dev, |
| tt_boot_fs_fd * | fds, | ||
| size_t | nfds, | ||
| size_t | offset ) |
List file descriptors in boot filesystem.
Read up to nfds file descriptors from a boot filesystem on flash device flash_dev starting from index offset. If reading from flash_dev causes an error, then this function will return -EIO. If flash_dev does not contain a valid boot fs, this function returns -ENXIO. On success, the number of file descriptors is returned.
This function may also be used to count the number of files that exist on a boot filesystem if fds is NULL. In that case, the nfds and offset parameters are ignored.
| dev | Flash device containing the boot filesystem |
| fds | Output array to store file descriptors, or NULL to count files |
| nfds | Maximum number of file descriptors to read |
| offset | File index from which to begin reading file descriptors |
| int tt_boot_fs_mount | ( | tt_boot_fs * | tt_boot_fs, |
| tt_boot_fs_read | hal_read, | ||
| tt_boot_fs_write | hal_write, | ||
| tt_boot_fs_erase | hal_erase ) |
|
static |
| tt_boot_fs boot_fs_data |