Coverage Report

Created: 2025-06-22 06:29

/work/fu-cros-ec-struct.c
Line
Count
Source (jump to first uncovered line)
1
/* auto-generated, do not modify */
2
#include "config.h"
3
4
#include "fu-cros-ec-struct.h"
5
#include "fu-byte-array.h"
6
#include "fu-mem-private.h"
7
#include "fu-string.h"
8
9
#ifdef G_LOG_DOMAIN
10
  #undef G_LOG_DOMAIN
11
#endif
12
0
#define G_LOG_DOMAIN "FuStruct"
13
14
15
16
/* getters */
17
18
/* setters */
19
/**
20
 * fu_struct_cros_ec_update_frame_header_set_block_size: (skip):
21
 **/
22
void
23
fu_struct_cros_ec_update_frame_header_set_block_size(FuStructCrosEcUpdateFrameHeader *st, guint32 value)
24
0
{
25
0
    g_return_if_fail(st != NULL);
26
0
    fu_memwrite_uint32(st->data + 0, value, G_BIG_ENDIAN);
27
0
}
28
/**
29
 * fu_struct_cros_ec_update_frame_header_set_cmd_block_base: (skip):
30
 **/
31
void
32
fu_struct_cros_ec_update_frame_header_set_cmd_block_base(FuStructCrosEcUpdateFrameHeader *st, guint32 value)
33
0
{
34
0
    g_return_if_fail(st != NULL);
35
0
    fu_memwrite_uint32(st->data + 8, value, G_BIG_ENDIAN);
36
0
}
37
/**
38
 * fu_struct_cros_ec_update_frame_header_new: (skip):
39
 **/
40
FuStructCrosEcUpdateFrameHeader *
41
fu_struct_cros_ec_update_frame_header_new(void)
42
0
{
43
0
    FuStructCrosEcUpdateFrameHeader *st = g_byte_array_sized_new(12);
44
0
    fu_byte_array_set_size(st, 12, 0x0);
45
0
    return st;
46
0
}
47
/* getters */
48
49
/* setters */
50
/**
51
 * fu_struct_cros_ec_update_done_set_value: (skip):
52
 **/
53
static void
54
fu_struct_cros_ec_update_done_set_value(FuStructCrosEcUpdateDone *st, guint32 value)
55
0
{
56
0
    g_return_if_fail(st != NULL);
57
0
    fu_memwrite_uint32(st->data + 0, value, G_BIG_ENDIAN);
58
0
}
59
/**
60
 * fu_struct_cros_ec_update_done_new: (skip):
61
 **/
62
FuStructCrosEcUpdateDone *
63
fu_struct_cros_ec_update_done_new(void)
64
0
{
65
0
    FuStructCrosEcUpdateDone *st = g_byte_array_sized_new(4);
66
0
    fu_byte_array_set_size(st, 4, 0x0);
67
0
    fu_struct_cros_ec_update_done_set_value(st, 0xB007AB1E);
68
0
    return st;
69
0
}
70
/* getters */
71
72
/* setters */
73
/* getters */
74
/**
75
 * fu_struct_cros_ec_first_response_pdu_get_return_value: (skip):
76
 **/
77
guint32
78
fu_struct_cros_ec_first_response_pdu_get_return_value(const FuStructCrosEcFirstResponsePdu *st)
79
0
{
80
0
    g_return_val_if_fail(st != NULL, 0x0);
81
0
    return fu_memread_uint32(st->data + 0, G_BIG_ENDIAN);
82
0
}
83
/**
84
 * fu_struct_cros_ec_first_response_pdu_get_header_type: (skip):
85
 **/
86
FuStructCrosEcFirstResponsePduHeaderType
87
fu_struct_cros_ec_first_response_pdu_get_header_type(const FuStructCrosEcFirstResponsePdu *st)
88
0
{
89
0
    g_return_val_if_fail(st != NULL, 0x0);
90
0
    return fu_memread_uint16(st->data + 4, G_BIG_ENDIAN);
91
0
}
92
/**
93
 * fu_struct_cros_ec_first_response_pdu_get_protocol_version: (skip):
94
 **/
95
guint16
96
fu_struct_cros_ec_first_response_pdu_get_protocol_version(const FuStructCrosEcFirstResponsePdu *st)
97
0
{
98
0
    g_return_val_if_fail(st != NULL, 0x0);
99
0
    return fu_memread_uint16(st->data + 6, G_BIG_ENDIAN);
100
0
}
101
/**
102
 * fu_struct_cros_ec_first_response_pdu_get_maximum_pdu_size: (skip):
103
 **/
104
guint32
105
fu_struct_cros_ec_first_response_pdu_get_maximum_pdu_size(const FuStructCrosEcFirstResponsePdu *st)
106
0
{
107
0
    g_return_val_if_fail(st != NULL, 0x0);
108
0
    return fu_memread_uint32(st->data + 8, G_BIG_ENDIAN);
109
0
}
110
/**
111
 * fu_struct_cros_ec_first_response_pdu_get_flash_protection: (skip):
112
 **/
113
guint32
114
fu_struct_cros_ec_first_response_pdu_get_flash_protection(const FuStructCrosEcFirstResponsePdu *st)
115
0
{
116
0
    g_return_val_if_fail(st != NULL, 0x0);
117
0
    return fu_memread_uint32(st->data + 12, G_BIG_ENDIAN);
118
0
}
119
/**
120
 * fu_struct_cros_ec_first_response_pdu_get_offset: (skip):
121
 **/
122
guint32
123
fu_struct_cros_ec_first_response_pdu_get_offset(const FuStructCrosEcFirstResponsePdu *st)
124
0
{
125
0
    g_return_val_if_fail(st != NULL, 0x0);
126
0
    return fu_memread_uint32(st->data + 16, G_BIG_ENDIAN);
127
0
}
128
/**
129
 * fu_struct_cros_ec_first_response_pdu_get_version: (skip):
130
 **/
131
gchar *
132
fu_struct_cros_ec_first_response_pdu_get_version(const FuStructCrosEcFirstResponsePdu *st)
133
0
{
134
0
    g_return_val_if_fail(st != NULL, NULL);
135
0
    return fu_memstrsafe(st->data, st->len, 20, 32, NULL);
136
0
}
137
138
/* setters */
139
/**
140
 * fu_struct_cros_ec_first_response_pdu_set_return_value: (skip):
141
 **/
142
void
143
fu_struct_cros_ec_first_response_pdu_set_return_value(FuStructCrosEcFirstResponsePdu *st, guint32 value)
144
0
{
145
0
    g_return_if_fail(st != NULL);
146
0
    fu_memwrite_uint32(st->data + 0, value, G_BIG_ENDIAN);
147
0
}
148
/**
149
 * fu_struct_cros_ec_first_response_pdu_set_header_type: (skip):
150
 **/
151
void
152
fu_struct_cros_ec_first_response_pdu_set_header_type(FuStructCrosEcFirstResponsePdu *st, FuStructCrosEcFirstResponsePduHeaderType value)
153
0
{
154
0
    g_return_if_fail(st != NULL);
155
0
    fu_memwrite_uint16(st->data + 4, value, G_BIG_ENDIAN);
156
0
}
157
/**
158
 * fu_struct_cros_ec_first_response_pdu_set_protocol_version: (skip):
159
 **/
160
void
161
fu_struct_cros_ec_first_response_pdu_set_protocol_version(FuStructCrosEcFirstResponsePdu *st, guint16 value)
162
0
{
163
0
    g_return_if_fail(st != NULL);
164
0
    fu_memwrite_uint16(st->data + 6, value, G_BIG_ENDIAN);
165
0
}
166
/**
167
 * fu_struct_cros_ec_first_response_pdu_set_maximum_pdu_size: (skip):
168
 **/
169
void
170
fu_struct_cros_ec_first_response_pdu_set_maximum_pdu_size(FuStructCrosEcFirstResponsePdu *st, guint32 value)
171
0
{
172
0
    g_return_if_fail(st != NULL);
173
0
    fu_memwrite_uint32(st->data + 8, value, G_BIG_ENDIAN);
174
0
}
175
/**
176
 * fu_struct_cros_ec_first_response_pdu_set_flash_protection: (skip):
177
 **/
178
void
179
fu_struct_cros_ec_first_response_pdu_set_flash_protection(FuStructCrosEcFirstResponsePdu *st, guint32 value)
180
0
{
181
0
    g_return_if_fail(st != NULL);
182
0
    fu_memwrite_uint32(st->data + 12, value, G_BIG_ENDIAN);
183
0
}
184
/**
185
 * fu_struct_cros_ec_first_response_pdu_set_offset: (skip):
186
 **/
187
void
188
fu_struct_cros_ec_first_response_pdu_set_offset(FuStructCrosEcFirstResponsePdu *st, guint32 value)
189
0
{
190
0
    g_return_if_fail(st != NULL);
191
0
    fu_memwrite_uint32(st->data + 16, value, G_BIG_ENDIAN);
192
0
}
193
/**
194
 * fu_struct_cros_ec_first_response_pdu_set_version: (skip):
195
 **/
196
gboolean
197
fu_struct_cros_ec_first_response_pdu_set_version(FuStructCrosEcFirstResponsePdu *st, const gchar *value, GError **error)
198
0
{
199
0
    gsize len;
200
0
    g_return_val_if_fail(st != NULL, FALSE);
201
0
    g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
202
0
    if (value == NULL) {
203
0
        memset(st->data + 20, 0x0, 32);
204
0
        return TRUE;
205
0
    }
206
0
    len = strlen(value);
207
0
    if (len > 32) {
208
0
        g_set_error(error,
209
0
                    FWUPD_ERROR,
210
0
                    FWUPD_ERROR_INVALID_DATA,
211
0
                    "string '%s' (0x%x bytes) does not fit in FuStructCrosEcFirstResponsePdu.version (0x%x bytes)",
212
0
                    value, (guint) len, (guint) 32);
213
0
        return FALSE;
214
0
    }
215
0
    return fu_memcpy_safe(st->data, st->len, 20, (const guint8 *)value, len, 0x0, len, error);
216
0
}
217
/**
218
 * fu_struct_cros_ec_first_response_pdu_new: (skip):
219
 **/
220
FuStructCrosEcFirstResponsePdu *
221
fu_struct_cros_ec_first_response_pdu_new(void)
222
0
{
223
0
    FuStructCrosEcFirstResponsePdu *st = g_byte_array_sized_new(60);
224
0
    fu_byte_array_set_size(st, 60, 0x0);
225
0
    return st;
226
0
}