/*
 * This file is auto-generated, do not modify!
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 */

#pragma once
#include <fu-input-stream.h>
/**
 * FuUf2FirmwareBlockFlags:
 */
typedef enum {
    /**
     * FU_UF2_FIRMWARE_BLOCK_FLAG_NONE:
     */
    FU_UF2_FIRMWARE_BLOCK_FLAG_NONE = 0x00000000,
    /**
     * FU_UF2_FIRMWARE_BLOCK_FLAG_NOFLASH:
     */
    FU_UF2_FIRMWARE_BLOCK_FLAG_NOFLASH = 0x00000001,
    /**
     * FU_UF2_FIRMWARE_BLOCK_FLAG_IS_CONTAINER:
     */
    FU_UF2_FIRMWARE_BLOCK_FLAG_IS_CONTAINER = 0x00001000,
    /**
     * FU_UF2_FIRMWARE_BLOCK_FLAG_HAS_FAMILY:
     */
    FU_UF2_FIRMWARE_BLOCK_FLAG_HAS_FAMILY = 0x00002000,
    /**
     * FU_UF2_FIRMWARE_BLOCK_FLAG_HAS_MD5:
     */
    FU_UF2_FIRMWARE_BLOCK_FLAG_HAS_MD5 = 0x00004000,
    /**
     * FU_UF2_FIRMWARE_BLOCK_FLAG_HAS_EXTENSION_TAG:
     */
    FU_UF2_FIRMWARE_BLOCK_FLAG_HAS_EXTENSION_TAG = 0x00008000,
}  FuUf2FirmwareBlockFlags;
/**
 * FuUf2FirmwareTag:
 */
typedef enum {
    /**
     * FU_UF2_FIRMWARE_TAG_VERSION:
     *
     * semver of firmware file (UTF-8)
     */
    FU_UF2_FIRMWARE_TAG_VERSION = 0x9FC7BC,
    /**
     * FU_UF2_FIRMWARE_TAG_DESCRIPTION:
     *
     * description of device (UTF-8)
     */
    FU_UF2_FIRMWARE_TAG_DESCRIPTION = 0x650D9D,
    /**
     * FU_UF2_FIRMWARE_TAG_PAGE_SZ:
     *
     * page size of target device (uint32_t)
     */
    FU_UF2_FIRMWARE_TAG_PAGE_SZ = 0x0BE9F7,
    /**
     * FU_UF2_FIRMWARE_TAG_SHA2:
     *
     * checksum of firmware
     */
    FU_UF2_FIRMWARE_TAG_SHA2 = 0xB46DB0,
    /**
     * FU_UF2_FIRMWARE_TAG_DEVICE_ID:
     *
     * device type identifier (uint32_t or uint64_t)
     */
    FU_UF2_FIRMWARE_TAG_DEVICE_ID = 0xC8A729,
}  FuUf2FirmwareTag;
const gchar *fu_uf2_firmware_tag_to_string(FuUf2FirmwareTag val) G_GNUC_CONST;
typedef struct {
  GByteArray *buf;
  guint refcount;
} FuStructUf2Extension;

FuStructUf2Extension *fu_struct_uf2_extension_ref(FuStructUf2Extension *st) G_GNUC_NON_NULL(1);
void fu_struct_uf2_extension_unref(FuStructUf2Extension *st) G_GNUC_NON_NULL(1);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(FuStructUf2Extension, fu_struct_uf2_extension_unref)
FuStructUf2Extension *fu_struct_uf2_extension_new(void) G_GNUC_WARN_UNUSED_RESULT;
FuStructUf2Extension *fu_struct_uf2_extension_parse(const guint8 *buf, gsize bufsz, gsize offset, GError **error) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
guint8 fu_struct_uf2_extension_get_size(const FuStructUf2Extension *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
FuUf2FirmwareTag fu_struct_uf2_extension_get_tag(const FuStructUf2Extension *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
void fu_struct_uf2_extension_set_size(FuStructUf2Extension *st, guint8 value) G_GNUC_NON_NULL(1);
void fu_struct_uf2_extension_set_tag(FuStructUf2Extension *st, FuUf2FirmwareTag value) G_GNUC_NON_NULL(1);

#ifndef __GI_SCANNER__
#define FU_STRUCT_UF2_EXTENSION_OFFSET_SIZE 0x0
#define FU_STRUCT_UF2_EXTENSION_OFFSET_TAG 0x1
#endif

#ifndef __GI_SCANNER__
#define FU_STRUCT_UF2_EXTENSION_SIZE 0x4
#endif

#ifndef __GI_SCANNER__
#endif
typedef struct {
  GByteArray *buf;
  guint refcount;
} FuStructUf2;

FuStructUf2 *fu_struct_uf2_ref(FuStructUf2 *st) G_GNUC_NON_NULL(1);
void fu_struct_uf2_unref(FuStructUf2 *st) G_GNUC_NON_NULL(1);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(FuStructUf2, fu_struct_uf2_unref)
FuStructUf2 *fu_struct_uf2_new(void) G_GNUC_WARN_UNUSED_RESULT;
FuStructUf2 *fu_struct_uf2_parse(const guint8 *buf, gsize bufsz, gsize offset, GError **error) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
FuUf2FirmwareBlockFlags fu_struct_uf2_get_flags(const FuStructUf2 *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
guint32 fu_struct_uf2_get_target_addr(const FuStructUf2 *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
guint32 fu_struct_uf2_get_payload_size(const FuStructUf2 *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
guint32 fu_struct_uf2_get_block_no(const FuStructUf2 *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
guint32 fu_struct_uf2_get_num_blocks(const FuStructUf2 *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
guint32 fu_struct_uf2_get_family_id(const FuStructUf2 *st) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
const guint8 *fu_struct_uf2_get_data(const FuStructUf2 *st, gsize *bufsz) G_GNUC_NON_NULL(1) G_GNUC_WARN_UNUSED_RESULT;
void fu_struct_uf2_set_flags(FuStructUf2 *st, FuUf2FirmwareBlockFlags value) G_GNUC_NON_NULL(1);
void fu_struct_uf2_set_target_addr(FuStructUf2 *st, guint32 value) G_GNUC_NON_NULL(1);
void fu_struct_uf2_set_payload_size(FuStructUf2 *st, guint32 value) G_GNUC_NON_NULL(1);
void fu_struct_uf2_set_block_no(FuStructUf2 *st, guint32 value) G_GNUC_NON_NULL(1);
void fu_struct_uf2_set_num_blocks(FuStructUf2 *st, guint32 value) G_GNUC_NON_NULL(1);
void fu_struct_uf2_set_family_id(FuStructUf2 *st, guint32 value) G_GNUC_NON_NULL(1);
gboolean fu_struct_uf2_set_data(FuStructUf2 *st, const guint8 *buf, gsize bufsz, GError **error) G_GNUC_NON_NULL(1, 2) G_GNUC_WARN_UNUSED_RESULT;

#ifndef __GI_SCANNER__
#define FU_STRUCT_UF2_OFFSET_MAGIC0 0x0
#define FU_STRUCT_UF2_OFFSET_MAGIC1 0x4
#define FU_STRUCT_UF2_OFFSET_FLAGS 0x8
#define FU_STRUCT_UF2_OFFSET_TARGET_ADDR 0xC
#define FU_STRUCT_UF2_OFFSET_PAYLOAD_SIZE 0x10
#define FU_STRUCT_UF2_OFFSET_BLOCK_NO 0x14
#define FU_STRUCT_UF2_OFFSET_NUM_BLOCKS 0x18
#define FU_STRUCT_UF2_OFFSET_FAMILY_ID 0x1C
#define FU_STRUCT_UF2_OFFSET_DATA 0x20
#define FU_STRUCT_UF2_OFFSET_MAGIC_END 0x1FC
#endif

#ifndef __GI_SCANNER__
#define FU_STRUCT_UF2_SIZE_DATA 0x1DC
#define FU_STRUCT_UF2_N_ELEMENTS_DATA 476
#define FU_STRUCT_UF2_SIZE 0x200
#endif

#ifndef __GI_SCANNER__
#define FU_STRUCT_UF2_DEFAULT_MAGIC0 0x0A324655
#define FU_STRUCT_UF2_DEFAULT_MAGIC1 0x9E5D5157
#define FU_STRUCT_UF2_DEFAULT_MAGIC_END 0x0AB16F30
#endif
