Files
Mika Liljeberg 71fe53031f firmware-api: fix kernel patch validation issues
Fix some warnings and errors raised by kernel patch validation
and correct some divergence from firmware-api.

Jira CAMERASW-16411

Change-Id: If3ce65b5996d73620d0a730e91a24a4114b7ffd5
Signed-off-by: Mika Liljeberg <mliljeberg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2993559
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3000505
Reviewed-by: Pekka Pessi <ppessi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-20 17:09:29 -07:00

89 lines
1.6 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*/
/**
* @file camrtc-common.h
*
* @brief RCE common header file
*/
#ifndef INCLUDE_CAMRTC_COMMON_H
#define INCLUDE_CAMRTC_COMMON_H
#if defined(__KERNEL__)
#include <linux/types.h>
#include <linux/compiler.h>
#define CAMRTC_PACKED __packed
#define CAMRTC_ALIGN __aligned
#else
#include <stdint.h>
#include <stdbool.h>
#ifndef CAMRTC_PACKED
#define CAMRTC_PACKED __attribute__((packed))
#endif
#ifndef CAMRTC_ALIGN
#define CAMRTC_ALIGN(_n) __attribute__((aligned(_n)))
#endif
#ifndef U64_C
#define U64_C(_x_) ((uint64_t)(_x_##ULL))
#endif
#ifndef U32_C
#define U32_C(_x_) ((uint32_t)(_x_##UL))
#endif
#ifndef U16_C
#define U16_C(_x_) ((uint16_t)(_x_##U))
#endif
#ifndef U8_C
#define U8_C(_x_) ((uint8_t)(_x_##U))
#endif
#endif
/**
* @defgroup MK_xxx Macros for defining constants
*
* These macros are used to define constants in the camera/firmware-api
* headers.
*
* The user of the header files can predefine them and override the
* types of the constants.
*
* @{
*/
#ifndef MK_U64
#define MK_U64(_x_) U64_C(_x_)
#endif
#ifndef MK_U32
#define MK_U32(_x_) U32_C(_x_)
#endif
#ifndef MK_U16
#define MK_U16(_x_) U16_C(_x_)
#endif
#ifndef MK_U8
#define MK_U8(_x_) U8_C(_x_)
#endif
#ifndef MK_BIT32
#define MK_BIT32(_x_) (MK_U32(1) << MK_U32(_x_))
#endif
#ifndef MK_BIT64
#define MK_BIT64(_x_) (MK_U64(1) << MK_U64(_x_))
#endif
#ifndef MK_ALIGN
#define MK_ALIGN(_x_) _x_
#endif
#ifndef MK_SIZE
#define MK_SIZE(_x_) MK_U32(_x_)
#endif
/** @} */
#endif /* INCLUDE_CAMRTC_COMMON_H */