1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2016-2018 NXP
3 * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com>
5 #ifndef _LINUX_PACKING_H
6 #define _LINUX_PACKING_H
8 #include <linux/types.h>
9 #include <linux/bitops.h>
11 #define QUIRK_MSB_ON_THE_RIGHT BIT(0)
12 #define QUIRK_LITTLE_ENDIAN BIT(1)
13 #define QUIRK_LSW32_IS_FIRST BIT(2)
20 int packing(void *pbuf
, u64
*uval
, int startbit
, int endbit
, size_t pbuflen
,
21 enum packing_op op
, u8 quirks
);
23 int pack(void *pbuf
, u64 uval
, size_t startbit
, size_t endbit
, size_t pbuflen
,
26 int unpack(const void *pbuf
, u64
*uval
, size_t startbit
, size_t endbit
,
27 size_t pbuflen
, u8 quirks
);