Switchtec Userspace  PROJECT_NUMBER = PROJECT_NUMBER=PROJECT_NUMBER = 2.2
Classes | Functions
fw.c File Reference

Switchtec core library functions for firmware operations. More...

#include "switchtec_priv.h"
#include "switchtec/switchtec.h"
#include "switchtec/errors.h"
#include "switchtec/endian.h"
#include "switchtec/utils.h"
#include "switchtec/mfg.h"
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
Include dependency graph for fw.c:

Go to the source code of this file.

Classes

struct  switchtec_fw_footer_gen3
 
struct  switchtec_fw_metadata_gen4
 
struct  switchtec_fw_image_header_gen3
 
struct  cmd_fwdl
 
struct  cmd_fwdl::cmd_fwdl_hdr
 
struct  switchtec_flash_info_gen4
 
struct  switchtec_flash_info_gen4::switchtec_flash_part_info_gen4
 
struct  switchtec_boot_ro
 

Functions

int switchtec_fw_toggle_active_partition (struct switchtec_dev *dev, int toggle_bl2, int toggle_key, int toggle_fw, int toggle_cfg)
 Toggle the active firmware partition for the main or configuration images. More...
 
int switchtec_fw_setup_redundancy (struct switchtec_dev *dev, enum switchtec_fw_redundancy redund, enum switchtec_fw_type type)
 Set or clear the redundancy flag of a partition type. More...
 
int switchtec_fw_write_fd (struct switchtec_dev *dev, int img_fd, int dont_activate, int force, void(*progress_callback)(int cur, int tot))
 Write a firmware file to the switchtec device. More...
 
int switchtec_fw_write_file (struct switchtec_dev *dev, FILE *fimg, int dont_activate, int force, void(*progress_callback)(int cur, int tot))
 Write a firmware file to the switchtec device. More...
 
void switchtec_fw_perror (const char *s, int ret)
 Print an error string to stdout. More...
 
int switchtec_fw_file_info (int fd, struct switchtec_fw_image_info *info)
 Retrieve information about a firmware image file. More...
 
int switchtec_fw_file_secure_version_newer (struct switchtec_dev *dev, int img_fd)
 Check if the secure version of an image file is newer than that of the image on device. More...
 
const char * switchtec_fw_image_type (const struct switchtec_fw_image_info *info)
 Return a string describing the type of a firmware image. More...
 
static int switchtec_fw_part_info (struct switchtec_dev *dev, int nr_info, struct switchtec_fw_image_info *info)
 Return firmware information structures for a number of firmware partitions. More...
 
struct switchtec_fw_part_summaryswitchtec_fw_part_summary (struct switchtec_dev *dev)
 Return firmware summary information structure for the flash partitfons in the device. More...
 
void switchtec_fw_part_summary_free (struct switchtec_fw_part_summary *summary)
 Free a firmware part summary data structure. More...
 
int switchtec_fw_read (struct switchtec_dev *dev, unsigned long addr, size_t len, void *buf)
 Read a Switchtec device's flash data. More...
 
int switchtec_fw_read_fd (struct switchtec_dev *dev, int fd, unsigned long addr, size_t len, void(*progress_callback)(int cur, int tot))
 Read a Switchtec device's flash data into a file. More...
 
int switchtec_fw_body_read_fd (struct switchtec_dev *dev, int fd, struct switchtec_fw_image_info *info, void(*progress_callback)(int cur, int tot))
 Read a Switchtec device's flash image body into a file. More...
 
int switchtec_fw_img_write_hdr (int fd, struct switchtec_fw_image_info *info)
 Write the header for a Switchtec firmware image file. More...
 
int switchtec_fw_is_boot_ro (struct switchtec_dev *dev)
 Check if the boot partition is marked as read-only. More...
 
int switchtec_fw_set_boot_ro (struct switchtec_dev *dev, enum switchtec_fw_ro ro)
 Set or clear a boot partition's read-only flag. More...
 

Detailed Description

Switchtec core library functions for firmware operations.

Definition in file fw.c.