Files
linux-nv-oot/include/media/fusa-capture/capture-coe.h
Rakibul Hassan f374450381 coe: Add Camera Over Ethernet cababilities
The following change is a squash change that aims to reintroduce
Camera Over Ethernet (CoE) functionality to kernel.

Bug 5401884
Bug 5419655

Change-Id: Id2fc0263c43ed8566241dbf712aa603a3b3a76f4
Signed-off-by: Rakibul Hassan <rakibulh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3419627
Reviewed-by: Anubhav Rai <arai@nvidia.com>
Reviewed-by: Narendra Kondapalli <nkondapalli@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Igor Mitsyanko <imitsyanko@nvidia.com>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
2025-07-30 07:15:10 -07:00

102 lines
4.1 KiB
C

// SPDX-License-Identifier: GPL-2.0-only
/* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
* All rights reserved.
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*/
#ifndef __FUSA_CAPTURE_COE_H__
#define __FUSA_CAPTURE_COE_H__
#if defined(__KERNEL__)
#include <linux/compiler.h>
#include <linux/types.h>
#else
#include <stdint.h>
#endif
#include <linux/ioctl.h>
#include <linux/if_ether.h>
#include <linux/if.h>
#define __COE_CAPTURE_ALIGN __aligned(8)
/**
* @brief CoE channel setup config (COE_IOCTL_CAPTURE_SETUP payload).
*
*/
struct coe_ioctl_data_capture_setup {
char if_name[IFNAMSIZ]; /**< Net interface through which the camera is accessible */
int32_t scratchBufMem; /**< Memory handle of a scratch buffer allocated by a user */
uint8_t sensor_mac_addr[ETH_ALEN]; /**< Ethernet MAC address of a camera */
uint8_t vlan_enable; /**< VLAN enable value. 1 - VLAN enabled, 0 - VLAN disabled */
uint8_t reserved[1U];
} __COE_CAPTURE_ALIGN;
/**
* @brief CoE channel buffer operation (COE_IOCTL_BUFFER_OP payload).
*/
struct coe_ioctl_data_buffer_op {
uint32_t mem; /**< handle to a buffer. */
uint32_t flag; /**< Buffer @ref CAPTURE_BUFFER_OPS bitmask. */
} __COE_CAPTURE_ALIGN;
/**
* @brief Enqueue CoE capture request (COE_IOCTL_CAPTURE_REQ payload).
*
* Issue a capture request using a specified buffer mem_fd.
* A buffer must previously have been registered with COE_IOCTL_BUFFER_OP.
* mem_fd_offset specifies the offset from the beginning of the buffer memory from which
* data should be received into. It can be used if an application makes a single large
* allocation for all image memory, and then specifies separate offset within it for each
* capture.
* capture_number is used to track the capture number in userspace. The same capture_number
* is returned by the driver in coe_ioctl_data_capture_status when capture is completed.
*/
struct coe_ioctl_data_capture_req {
uint32_t mem_fd; /**< handle to a buffer. */
uint32_t buf_size; /**< capture image size in bytes */
uint32_t mem_fd_offset; /**< offset from the beginning of a mem_fd */
uint32_t capture_number; /**< capture number for a tracking by userspace */
} __COE_CAPTURE_ALIGN;
/**
* @brief Wait on the next completion of an enqueued frame (COE_IOCTL_CAPTURE_STATUS payload).
*
* Wait for the next capture completion with the specified timeout.
* The status of the capture will be returned via capture_status.
*
* @param[in] timeout_ms uint32_t timeout in [ms], 0 for indefinite wait.
* @param[out] capture_number uint32_t capture number for which the status is returned.
* @param[out] capture_status uint32_t capture status, Valid range: [ @ref CAPTURE_STATUS_UNKNOWN,
* @ref CAPTURE_STATUS_INVALID_CAP_SETTINGS]
* @param[out] errData uint32_t extended error data.
* @param[out] sofTimestamp uint64_t start-of-frame time stamp in nanoseconds.
* @param[out] eofTimestamp uint64_t end-of-frame time stamp in nanoseconds.
*/
struct coe_ioctl_data_capture_status {
uint32_t timeout_ms; /**< Capture timeout in milliseconds. */
uint32_t capture_number; /**< capture number passed with coe_ioctl_data_capture_req */
uint32_t capture_status; /**< Capture status returned by the driver. */
uint32_t errData; /**< Extended error data. */
uint64_t sofTimestamp; /**< Start-of-frame time stamp in nanoseconds. */
uint64_t eofTimestamp; /**< End-of-frame time stamp in nanoseconds. */
} __COE_CAPTURE_ALIGN;
/**
* @brief Get info on CoE channel (COE_IOCTL_GET_INFO payload).
*/
struct coe_ioctl_data_get_info {
uint8_t channel_number; /**< channel number value assigned by a driver */
uint8_t reserved[7U];
} __COE_CAPTURE_ALIGN;
#endif /* __FUSA_CAPTURE_COE_H__ */