summaryrefslogtreecommitdiff
path: root/cmd/sbc_harness/uf2.h
blob: bf9e032bceba3042a110ead3d85fc8c512265951 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* sbc_harness/uf2.h - Universal Flashing Format
 *
 * Copyright (C) 2025  Luke T. Shumaker <lukeshu@lukeshu.com>
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

#ifndef _SBC_HARNESS_FS_HARNESS_UF2_H_
#define _SBC_HARNESS_FS_HARNESS_UF2_H_

#include <stddef.h>  /* for size_t */
#include <stdint.h>  /* for uint{n}_t */

#include <libhw/generic/io.h>
#include <libmisc/private.h>

struct uf2_decoder {
	BEGIN_PRIVATE(UF2_H);
	bool            seen_err;
	size_t          dat_len;
	uint8_t         dat[512];
	uint32_t        bnum;
	uint32_t        bcnt;
	END_PRIVATE(UF2_H);
};
LO_IMPLEMENTATION_H(io_writer, struct uf2_decoder, uf2_decoder);

#endif /* _SBC_HARNESS_FS_HARNESS_UF2_H_ */