Coverage Report

Created: 2026-02-26 06:27

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/work/fu-cros-ec-struct.c
Line
Count
Source
1
/*
2
 * This file is auto-generated, do not modify!
3
 *
4
 * SPDX-License-Identifier: LGPL-2.1-or-later
5
 */
6
7
#include "config.h"
8
9
#include <glib.h>
10
11
#include "fu-cros-ec-struct.h"
12
#include "fu-byte-array.h"
13
#include "fu-bytes.h"
14
#include "fu-mem-private.h"
15
#include "fu-string.h"
16
17
#ifdef G_LOG_DOMAIN
18
  #undef G_LOG_DOMAIN
19
#endif
20
0
#define G_LOG_DOMAIN "FuStruct"
21
22
23
24
/**
25
 * fu_struct_cros_ec_update_frame_header_ref: (skip):
26
 **/
27
FuStructCrosEcUpdateFrameHeader *
28
fu_struct_cros_ec_update_frame_header_ref(FuStructCrosEcUpdateFrameHeader *st)
29
0
{
30
0
    g_return_val_if_fail(st != NULL, NULL);
31
0
    st->refcount++;
32
0
    return st;
33
0
}
34
/**
35
 * fu_struct_cros_ec_update_frame_header_unref: (skip):
36
 **/
37
void
38
fu_struct_cros_ec_update_frame_header_unref(FuStructCrosEcUpdateFrameHeader *st)
39
0
{
40
0
    g_return_if_fail(st != NULL);
41
0
    if (st->refcount == 0) {
42
0
        g_critical("FuStructCrosEcUpdateFrameHeader refcount already zero");
43
0
        return;
44
0
    }
45
0
    if (--st->refcount > 0)
46
0
        return;
47
0
    if (st->buf != NULL)
48
0
        g_byte_array_unref(st->buf);
49
0
    g_free(st);
50
0
}
51
/**
52
 * fu_struct_cros_ec_update_frame_header_new_internal: (skip):
53
 **/
54
static FuStructCrosEcUpdateFrameHeader *
55
fu_struct_cros_ec_update_frame_header_new_internal(void)
56
0
{
57
0
    FuStructCrosEcUpdateFrameHeader *st = g_new0(FuStructCrosEcUpdateFrameHeader, 1);
58
0
    st->refcount = 1;
59
0
    return st;
60
0
}
61
62
/* getters */
63
64
/* setters */
65
/**
66
 * fu_struct_cros_ec_update_frame_header_set_block_size: (skip):
67
 **/
68
void
69
fu_struct_cros_ec_update_frame_header_set_block_size(FuStructCrosEcUpdateFrameHeader *st, guint32 value)
70
0
{
71
0
    g_return_if_fail(st != NULL);
72
0
    fu_memwrite_uint32(st->buf->data + 0, value, G_BIG_ENDIAN);
73
0
}
74
/**
75
 * fu_struct_cros_ec_update_frame_header_set_cmd_block_digest: (skip):
76
 **/
77
void
78
fu_struct_cros_ec_update_frame_header_set_cmd_block_digest(FuStructCrosEcUpdateFrameHeader *st, guint32 value)
79
0
{
80
0
    g_return_if_fail(st != NULL);
81
0
    fu_memwrite_uint32(st->buf->data + 4, value, G_BIG_ENDIAN);
82
0
}
83
/**
84
 * fu_struct_cros_ec_update_frame_header_set_cmd_block_base: (skip):
85
 **/
86
void
87
fu_struct_cros_ec_update_frame_header_set_cmd_block_base(FuStructCrosEcUpdateFrameHeader *st, guint32 value)
88
0
{
89
0
    g_return_if_fail(st != NULL);
90
0
    fu_memwrite_uint32(st->buf->data + 8, value, G_BIG_ENDIAN);
91
0
}
92
/**
93
 * fu_struct_cros_ec_update_frame_header_new: (skip):
94
 **/
95
FuStructCrosEcUpdateFrameHeader *
96
fu_struct_cros_ec_update_frame_header_new(void)
97
0
{
98
0
    FuStructCrosEcUpdateFrameHeader *st = fu_struct_cros_ec_update_frame_header_new_internal();
99
0
    st->buf = g_byte_array_sized_new(12);
100
0
    fu_byte_array_set_size(st->buf, 12, 0x0);
101
0
    return st;
102
0
}
103
/**
104
 * fu_struct_cros_ec_update_done_ref: (skip):
105
 **/
106
FuStructCrosEcUpdateDone *
107
fu_struct_cros_ec_update_done_ref(FuStructCrosEcUpdateDone *st)
108
0
{
109
0
    g_return_val_if_fail(st != NULL, NULL);
110
0
    st->refcount++;
111
0
    return st;
112
0
}
113
/**
114
 * fu_struct_cros_ec_update_done_unref: (skip):
115
 **/
116
void
117
fu_struct_cros_ec_update_done_unref(FuStructCrosEcUpdateDone *st)
118
0
{
119
0
    g_return_if_fail(st != NULL);
120
0
    if (st->refcount == 0) {
121
0
        g_critical("FuStructCrosEcUpdateDone refcount already zero");
122
0
        return;
123
0
    }
124
0
    if (--st->refcount > 0)
125
0
        return;
126
0
    if (st->buf != NULL)
127
0
        g_byte_array_unref(st->buf);
128
0
    g_free(st);
129
0
}
130
/**
131
 * fu_struct_cros_ec_update_done_new_internal: (skip):
132
 **/
133
static FuStructCrosEcUpdateDone *
134
fu_struct_cros_ec_update_done_new_internal(void)
135
0
{
136
0
    FuStructCrosEcUpdateDone *st = g_new0(FuStructCrosEcUpdateDone, 1);
137
0
    st->refcount = 1;
138
0
    return st;
139
0
}
140
141
/* getters */
142
143
/* setters */
144
/**
145
 * fu_struct_cros_ec_update_done_set_value: (skip):
146
 **/
147
static void
148
fu_struct_cros_ec_update_done_set_value(FuStructCrosEcUpdateDone *st, guint32 value)
149
0
{
150
0
    g_return_if_fail(st != NULL);
151
0
    fu_memwrite_uint32(st->buf->data + 0, value, G_BIG_ENDIAN);
152
0
}
153
/**
154
 * fu_struct_cros_ec_update_done_new: (skip):
155
 **/
156
FuStructCrosEcUpdateDone *
157
fu_struct_cros_ec_update_done_new(void)
158
0
{
159
0
    FuStructCrosEcUpdateDone *st = fu_struct_cros_ec_update_done_new_internal();
160
0
    st->buf = g_byte_array_sized_new(4);
161
0
    fu_byte_array_set_size(st->buf, 4, 0x0);
162
0
    fu_struct_cros_ec_update_done_set_value(st, 0xB007AB1E);
163
0
    return st;
164
0
}
165
/**
166
 * fu_struct_cros_ec_signed_header_version_ref: (skip):
167
 **/
168
FuStructCrosEcSignedHeaderVersion *
169
fu_struct_cros_ec_signed_header_version_ref(FuStructCrosEcSignedHeaderVersion *st)
170
0
{
171
0
    g_return_val_if_fail(st != NULL, NULL);
172
0
    st->refcount++;
173
0
    return st;
174
0
}
175
/**
176
 * fu_struct_cros_ec_signed_header_version_unref: (skip):
177
 **/
178
void
179
fu_struct_cros_ec_signed_header_version_unref(FuStructCrosEcSignedHeaderVersion *st)
180
0
{
181
0
    g_return_if_fail(st != NULL);
182
0
    if (st->refcount == 0) {
183
0
        g_critical("FuStructCrosEcSignedHeaderVersion refcount already zero");
184
0
        return;
185
0
    }
186
0
    if (--st->refcount > 0)
187
0
        return;
188
0
    if (st->buf != NULL)
189
0
        g_byte_array_unref(st->buf);
190
0
    g_free(st);
191
0
}
192
193
/* getters */
194
195
/* setters */
196
/**
197
 * fu_struct_cros_ec_first_response_pdu_ref: (skip):
198
 **/
199
FuStructCrosEcFirstResponsePdu *
200
fu_struct_cros_ec_first_response_pdu_ref(FuStructCrosEcFirstResponsePdu *st)
201
0
{
202
0
    g_return_val_if_fail(st != NULL, NULL);
203
0
    st->refcount++;
204
0
    return st;
205
0
}
206
/**
207
 * fu_struct_cros_ec_first_response_pdu_unref: (skip):
208
 **/
209
void
210
fu_struct_cros_ec_first_response_pdu_unref(FuStructCrosEcFirstResponsePdu *st)
211
0
{
212
0
    g_return_if_fail(st != NULL);
213
0
    if (st->refcount == 0) {
214
0
        g_critical("FuStructCrosEcFirstResponsePdu refcount already zero");
215
0
        return;
216
0
    }
217
0
    if (--st->refcount > 0)
218
0
        return;
219
0
    if (st->buf != NULL)
220
0
        g_byte_array_unref(st->buf);
221
0
    g_free(st);
222
0
}
223
/**
224
 * fu_struct_cros_ec_first_response_pdu_new_internal: (skip):
225
 **/
226
static FuStructCrosEcFirstResponsePdu *
227
fu_struct_cros_ec_first_response_pdu_new_internal(void)
228
0
{
229
0
    FuStructCrosEcFirstResponsePdu *st = g_new0(FuStructCrosEcFirstResponsePdu, 1);
230
0
    st->refcount = 1;
231
0
    return st;
232
0
}
233
234
/* getters */
235
/**
236
 * fu_struct_cros_ec_first_response_pdu_get_return_value: (skip):
237
 **/
238
guint32
239
fu_struct_cros_ec_first_response_pdu_get_return_value(const FuStructCrosEcFirstResponsePdu *st)
240
0
{
241
0
    g_return_val_if_fail(st != NULL, 0x0);
242
0
    return fu_memread_uint32(st->buf->data + 0, G_BIG_ENDIAN);
243
0
}
244
/**
245
 * fu_struct_cros_ec_first_response_pdu_get_header_type: (skip):
246
 **/
247
FuStructCrosEcFirstResponsePduHeaderType
248
fu_struct_cros_ec_first_response_pdu_get_header_type(const FuStructCrosEcFirstResponsePdu *st)
249
0
{
250
0
    g_return_val_if_fail(st != NULL, 0x0);
251
0
    return fu_memread_uint16(st->buf->data + 4, G_BIG_ENDIAN);
252
0
}
253
/**
254
 * fu_struct_cros_ec_first_response_pdu_get_protocol_version: (skip):
255
 **/
256
guint16
257
fu_struct_cros_ec_first_response_pdu_get_protocol_version(const FuStructCrosEcFirstResponsePdu *st)
258
0
{
259
0
    g_return_val_if_fail(st != NULL, 0x0);
260
0
    return fu_memread_uint16(st->buf->data + 6, G_BIG_ENDIAN);
261
0
}
262
/**
263
 * fu_struct_cros_ec_first_response_pdu_get_maximum_pdu_size: (skip):
264
 **/
265
guint32
266
fu_struct_cros_ec_first_response_pdu_get_maximum_pdu_size(const FuStructCrosEcFirstResponsePdu *st)
267
0
{
268
0
    g_return_val_if_fail(st != NULL, 0x0);
269
0
    return fu_memread_uint32(st->buf->data + 8, G_BIG_ENDIAN);
270
0
}
271
/**
272
 * fu_struct_cros_ec_first_response_pdu_get_flash_protection: (skip):
273
 **/
274
guint32
275
fu_struct_cros_ec_first_response_pdu_get_flash_protection(const FuStructCrosEcFirstResponsePdu *st)
276
0
{
277
0
    g_return_val_if_fail(st != NULL, 0x0);
278
0
    return fu_memread_uint32(st->buf->data + 12, G_BIG_ENDIAN);
279
0
}
280
/**
281
 * fu_struct_cros_ec_first_response_pdu_get_offset: (skip):
282
 **/
283
guint32
284
fu_struct_cros_ec_first_response_pdu_get_offset(const FuStructCrosEcFirstResponsePdu *st)
285
0
{
286
0
    g_return_val_if_fail(st != NULL, 0x0);
287
0
    return fu_memread_uint32(st->buf->data + 16, G_BIG_ENDIAN);
288
0
}
289
/**
290
 * fu_struct_cros_ec_first_response_pdu_get_version: (skip):
291
 **/
292
gchar *
293
fu_struct_cros_ec_first_response_pdu_get_version(const FuStructCrosEcFirstResponsePdu *st)
294
0
{
295
0
    g_return_val_if_fail(st != NULL, NULL);
296
0
    return fu_memstrsafe(st->buf->data, st->buf->len, 20, 32, NULL);
297
0
}
298
299
/* setters */
300
/**
301
 * fu_struct_cros_ec_first_response_pdu_set_return_value: (skip):
302
 **/
303
void
304
fu_struct_cros_ec_first_response_pdu_set_return_value(FuStructCrosEcFirstResponsePdu *st, guint32 value)
305
0
{
306
0
    g_return_if_fail(st != NULL);
307
0
    fu_memwrite_uint32(st->buf->data + 0, value, G_BIG_ENDIAN);
308
0
}
309
/**
310
 * fu_struct_cros_ec_first_response_pdu_set_header_type: (skip):
311
 **/
312
void
313
fu_struct_cros_ec_first_response_pdu_set_header_type(FuStructCrosEcFirstResponsePdu *st, FuStructCrosEcFirstResponsePduHeaderType value)
314
0
{
315
0
    g_return_if_fail(st != NULL);
316
0
    fu_memwrite_uint16(st->buf->data + 4, value, G_BIG_ENDIAN);
317
0
}
318
/**
319
 * fu_struct_cros_ec_first_response_pdu_set_protocol_version: (skip):
320
 **/
321
void
322
fu_struct_cros_ec_first_response_pdu_set_protocol_version(FuStructCrosEcFirstResponsePdu *st, guint16 value)
323
0
{
324
0
    g_return_if_fail(st != NULL);
325
0
    fu_memwrite_uint16(st->buf->data + 6, value, G_BIG_ENDIAN);
326
0
}
327
/**
328
 * fu_struct_cros_ec_first_response_pdu_set_maximum_pdu_size: (skip):
329
 **/
330
void
331
fu_struct_cros_ec_first_response_pdu_set_maximum_pdu_size(FuStructCrosEcFirstResponsePdu *st, guint32 value)
332
0
{
333
0
    g_return_if_fail(st != NULL);
334
0
    fu_memwrite_uint32(st->buf->data + 8, value, G_BIG_ENDIAN);
335
0
}
336
/**
337
 * fu_struct_cros_ec_first_response_pdu_set_flash_protection: (skip):
338
 **/
339
void
340
fu_struct_cros_ec_first_response_pdu_set_flash_protection(FuStructCrosEcFirstResponsePdu *st, guint32 value)
341
0
{
342
0
    g_return_if_fail(st != NULL);
343
0
    fu_memwrite_uint32(st->buf->data + 12, value, G_BIG_ENDIAN);
344
0
}
345
/**
346
 * fu_struct_cros_ec_first_response_pdu_set_offset: (skip):
347
 **/
348
void
349
fu_struct_cros_ec_first_response_pdu_set_offset(FuStructCrosEcFirstResponsePdu *st, guint32 value)
350
0
{
351
0
    g_return_if_fail(st != NULL);
352
0
    fu_memwrite_uint32(st->buf->data + 16, value, G_BIG_ENDIAN);
353
0
}
354
/**
355
 * fu_struct_cros_ec_first_response_pdu_set_version: (skip):
356
 **/
357
gboolean
358
fu_struct_cros_ec_first_response_pdu_set_version(FuStructCrosEcFirstResponsePdu *st, const gchar *value, GError **error)
359
0
{
360
0
    gsize len;
361
0
    g_return_val_if_fail(st != NULL, FALSE);
362
0
    g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
363
0
    if (value == NULL) {
364
0
        memset(st->buf->data + 20, 0x0, 32);
365
0
        return TRUE;
366
0
    }
367
0
    len = strlen(value);
368
0
    if (len > 32) {
369
0
        g_set_error(error,
370
0
                    FWUPD_ERROR,
371
0
                    FWUPD_ERROR_INVALID_DATA,
372
0
                    "string '%s' (0x%x bytes) does not fit in FuStructCrosEcFirstResponsePdu.version (0x%x bytes)",
373
0
                    value, (guint) len, (guint) 32);
374
0
        return FALSE;
375
0
    }
376
0
    return fu_memcpy_safe(st->buf->data, st->buf->len, 20, (const guint8 *)value, len, 0x0, len, error);
377
0
}
378
/**
379
 * fu_struct_cros_ec_first_response_pdu_new: (skip):
380
 **/
381
FuStructCrosEcFirstResponsePdu *
382
fu_struct_cros_ec_first_response_pdu_new(void)
383
0
{
384
0
    FuStructCrosEcFirstResponsePdu *st = fu_struct_cros_ec_first_response_pdu_new_internal();
385
0
    st->buf = g_byte_array_sized_new(60);
386
0
    fu_byte_array_set_size(st->buf, 60, 0x0);
387
0
    return st;
388
0
}