diff options
author | Furquan Shaikh <furquan@google.com> | 2021-10-08 15:18:33 -0700 |
---|---|---|
committer | Furquan Shaikh <furquan@google.com> | 2021-10-19 16:08:45 +0000 |
commit | 555f0407721ca1c29e3d6f3a6f4076fdcb550915 (patch) | |
tree | 8b81402d1fc812d4a608c34995f9de050dfa61b7 /util/cbfstool/cse_helpers.h | |
parent | d7fb6a90e1d0130db18c84530272f5d35dd914b0 (diff) |
util/cse*: Add cse_helpers.{c,h}
This change moves `read_member` and `write_member` helper functions
out of cse_fpt.c and cse_serger.c into cse_helpers.c to avoid
duplication.
BUG=b:189177186,b:189167923
Change-Id: I7b646b29c9058d892bb0fc9824ef1b4340d2510c
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/58201
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Diffstat (limited to 'util/cbfstool/cse_helpers.h')
-rw-r--r-- | util/cbfstool/cse_helpers.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/util/cbfstool/cse_helpers.h b/util/cbfstool/cse_helpers.h new file mode 100644 index 0000000000..58ba128751 --- /dev/null +++ b/util/cbfstool/cse_helpers.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <stddef.h> + +#include "common.h" + +#define READ_MEMBER(_buff, _x) read_member(_buff, &(_x), sizeof(_x)) +#define WRITE_MEMBER(_buff, _x) write_member(_buff, &(_x), sizeof(_x)) + +/* Write data from `src` of length `size` to buffer in little-endian format and seek the buffer + forward by `size` bytes. */ +void write_member(struct buffer *buff, void *src, size_t size); + +/* Read data from buffer in little-endian format of length `size` to `dst` and seek the buffer + forward by `size` bytes. */ +void read_member(struct buffer *buff, void *dst, size_t size); |