TT Zephyr Platforms 18.11.99
Tenstorrent Firmware
Loading...
Searching...
No Matches
tt_boot_fs.c File Reference

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]

Function Documentation

◆ calculate_and_compare_checksum()

tt_checksum_res_t calculate_and_compare_checksum ( uint8_t * data,
size_t num_bytes,
uint32_t expected,
bool skip_checksum )
static

◆ find_fd_by_tag()

int find_fd_by_tag ( const tt_boot_fs * tt_boot_fs,
const uint8_t * tag,
tt_boot_fs_fd * fd_data )
static

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( tt_boot_fs ,
CONFIG_TT_APP_LOG_LEVEL  )

◆ tt_boot_fs_add_file()

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 )

◆ tt_boot_fs_cksum()

uint32_t tt_boot_fs_cksum ( uint32_t cksum,
const uint8_t * data,
size_t num_bytes )

◆ tt_boot_fs_find_fd_by_tag()

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

  • the address of the file in flash_dev,
  • the size of the file, and
  • the checksum of the file, and more.
Parameters
flash_devflash device containing the boot filesystem
tagname of the image to search for
[out]fdoptional pointer to memory where the file descriptor will be written, if found
Return values
0on success
-EIOif an I/O error occurs
-ENXIOif flash_dev does not contain a boot filesystem
-ENOENTif no file was found matching the specified tag

◆ tt_boot_fs_get_file()

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 )

◆ tt_boot_fs_load_cache()

int tt_boot_fs_load_cache ( tt_boot_fs * tt_boot_fs)
static

◆ tt_boot_fs_ls()

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.

Parameters
devFlash device containing the boot filesystem
fdsOutput array to store file descriptors, or NULL to count files
nfdsMaximum number of file descriptors to read
offsetFile index from which to begin reading file descriptors
Returns
the number of file descriptors successfully read or a negative error code on failure.

◆ tt_boot_fs_mount()

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 )

◆ tt_boot_fs_next()

uint32_t tt_boot_fs_next ( uint32_t last_fd_addr)

Variable Documentation

◆ boot_fs_cache

tt_boot_fs_fd boot_fs_cache[16]
static

◆ boot_fs_data

tt_boot_fs boot_fs_data