fwupd/plugins/ccgx/fu-ccgx-dmc-firmware.h
Richard Hughes 1981c63d58 Remove FuFirmwareImage and just use FuFirmware instead
This allows us to 'nest' firmware formats, and removes a ton of duplication.

The aim here is to deprecate FuFirmwareImage -- it's almost always acting
as a 'child' FuFirmware instance, and even copies most of the vfuncs to allow
custom types. If I'm struggling to work out what should be a FuFirmware and
what should be a FuFirmwareImage then a plugin author has no hope.

For simple payloads we were adding bytes into an image and then the image into
a firmware. This gets really messy when most plugins are treating the FuFirmware
*as* the binary firmware file.

The GBytes saved in the FuFirmware would be considered the payload with the
aim of not using FuFirmwareImage in the single-image case.
2021-03-09 21:14:12 +00:00

35 lines
1.0 KiB
C

/*
* Copyright (C) 2020 Cypress Semiconductor Corporation.
* Copyright (C) 2020 Richard Hughes <richard@hughsie.com>
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#pragma once
#include "fu-firmware.h"
#include "fu-ccgx-dmc-common.h"
#define FU_TYPE_CCGX_DMC_FIRMWARE (fu_ccgx_dmc_firmware_get_type ())
G_DECLARE_FINAL_TYPE (FuCcgxDmcFirmware, fu_ccgx_dmc_firmware, FU,CCGX_DMC_FIRMWARE, FuFirmware)
typedef struct {
guint16 start_row;
guint16 num_rows;
GPtrArray *data_records;
} FuCcgxDmcFirmwareSegmentRecord;
typedef struct {
guint8 row_size;
guint32 img_offset;
guint8 img_digest[32];
guint8 num_img_segments;
GPtrArray *seg_records;
} FuCcgxDmcFirmwareRecord;
FuFirmware *fu_ccgx_dmc_firmware_new (void);
GPtrArray *fu_ccgx_dmc_firmware_get_image_records (FuCcgxDmcFirmware *self);
GBytes *fu_ccgx_dmc_firmware_get_fwct_record (FuCcgxDmcFirmware *self);
GBytes *fu_ccgx_dmc_firmware_get_custom_meta_record (FuCcgxDmcFirmware *self);
guint32 fu_ccgx_dmc_firmware_get_fw_data_size (FuCcgxDmcFirmware *self);