30 lines
708 B
C
30 lines
708 B
C
/* SPDX-License-Identifier: BSD-3-Clause
|
|
* Copyright 2016-2018 NXP
|
|
* Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com>
|
|
*/
|
|
#ifndef _LINUX_PACKING_H
|
|
#define _LINUX_PACKING_H
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/bitops.h>
|
|
|
|
#define QUIRK_MSB_ON_THE_RIGHT BIT(0)
|
|
#define QUIRK_LITTLE_ENDIAN BIT(1)
|
|
#define QUIRK_LSW32_IS_FIRST BIT(2)
|
|
|
|
enum packing_op {
|
|
PACK,
|
|
UNPACK,
|
|
};
|
|
|
|
int packing(void *pbuf, u64 *uval, int startbit, int endbit, size_t pbuflen,
|
|
enum packing_op op, u8 quirks);
|
|
|
|
int pack(void *pbuf, u64 uval, size_t startbit, size_t endbit, size_t pbuflen,
|
|
u8 quirks);
|
|
|
|
int unpack(const void *pbuf, u64 *uval, size_t startbit, size_t endbit,
|
|
size_t pbuflen, u8 quirks);
|
|
|
|
#endif
|