NVIDIA DRIVE OS Linux API Reference

5.1.0.2 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
nvmedia_icp.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved. All
3  * information contained herein is proprietary and confidential to NVIDIA
4  * Corporation. Any use, reproduction, or disclosure without the written
5  * permission of NVIDIA Corporation is prohibited.
6  */
7 
15 #ifndef _NVMEDIA_ICP_H
16 #define _NVMEDIA_ICP_H
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 #include "nvmedia_core.h"
23 #include "nvmedia_surface.h"
24 #include "nvmedia_image.h"
25 
42 #define NVMEDIA_ICP_VERSION_MAJOR 4
43 
44 #define NVMEDIA_ICP_VERSION_MINOR 8
45 
50 #define NVMEDIA_IMAGE_CAPTURE_TIMEOUT_INFINITE 0xFFFFFFFF
51 
53 #define NVMEDIA_ICP_MAX_VIRTUAL_GROUPS 4u
54 
56 #define NVMEDIA_ICP_MAX_VIRTUAL_CHANNELS 3u
57 
62 #define NVMEDIA_ICP_HANDLER(icpEx, groupIdx) (icpEx->icp[groupIdx].hIcp)
63 
70 #define NVMEDIA_ICP_SETTINGS_HANDLER(icpSettingsEx, groupIdx, vcIdx) \
71  (&icpSettingsEx.virtualGroups[groupIdx].virtualChannels[vcIdx].icpSettings)
72 
81 #define NVMEDIA_ICP_ERROR(_type_, _error_, _value_, _desc_) \
82  NVMEDIA_ICP_##_type_##_ERROR_##_error_ = _value_,
83 
87 typedef enum {
113 
117 typedef enum {
159 
163 typedef struct {
170 
174 typedef enum {
175  /* CSI is in Dphy mode */
177  /* CSI is in CPHY mode */
180 
184 typedef struct {
192  uint16_t width;
194  uint16_t height;
196  uint16_t startX;
198  uint16_t startY;
202  uint32_t interfaceLanes;
205  uint32_t pixelFrequency;
207  uint32_t mipiSpeed;
209  uint16_t thsSettle;
214  uint8_t tpgEnable;
218 
223 typedef struct {
229  uint32_t interfaceLanes;
230  struct {
231  struct {
232  /* Holds the virtual Channel Index from CSI TX. */
234  /* Holds the image capture settings for CSI format. */
236  /* Holds the clipping rectangle. */
238  } virtualChannels[NVMEDIA_ICP_MAX_VIRTUAL_CHANNELS];
241  } virtualGroups[NVMEDIA_ICP_MAX_VIRTUAL_GROUPS];
247 
251 typedef void NvMediaICP;
252 
256 typedef struct {
257  /* Holds the number of virtual groups used. */
259  struct {
260  /* Holds the virtual Group Index. */
261  uint16_t virtualGroupId;
262  /* Holds the image capture handler. */
263  NvMediaICP *hIcp;
265 } NvMediaICPEx;
266 
302 typedef enum {
303  /* Unrecognized or no errors */
304  NVMEDIA_ICP_ERROR(CAPTURE, NONE, 0x0000, "Either no error occurred or error could not be translated")
305 
306  /* CSI mux frame errors */
307  NVMEDIA_ICP_ERROR(CSI, FS_FAULT, 0x0001, "A frame start occurred before previous frame end")
308  NVMEDIA_ICP_ERROR(CSI, FE_CSI_FAULT, 0x0002, "A NVCSI fault received at frame end")
309  NVMEDIA_ICP_ERROR(CSI, FE_FRAMEID_FAULT, 0x0003, "Frame ID for FE packet does not match that of FS packet")
310  NVMEDIA_ICP_ERROR(CSI, FE_FORCED_FAULT, 0x0004, "A frame end was injected by the CSI hardware")
311  NVMEDIA_ICP_ERROR(CSI, PXL_ENABLE_FAULT , 0x0005, "An illegal pixel encoding has been detected")
312 
313  /* VI channel sel errors */
314  NVMEDIA_ICP_ERROR(VI, SHORT_FRAME, 0x0010, "FE packet arrived before the normal number of pixels has appeared ")
315  NVMEDIA_ICP_ERROR(VI, FAULT_FE, 0x0011, "Data specific fault occurred on a channel")
316 
317  /* VI channel sel faults */
318  NVMEDIA_ICP_ERROR(VI, PXL_MISSING_LE, 0x0100, "Two LS packets were detected without a LE packet between them")
319  NVMEDIA_ICP_ERROR(VI, PXL_RUNAWAY, 0x0101, "More lines were received than expected")
320  NVMEDIA_ICP_ERROR(VI, PXL_SPURIOUS, 0x0102, "A pixel data packet was received without a LS packet first")
321  NVMEDIA_ICP_ERROR(VI, PXL_LONG_LINE, 0x0103, "More pixels were received than expected in a line")
322  NVMEDIA_ICP_ERROR(VI, PXL_SHORT_LINE, 0x0104, "Fewer pixels were received than expected in a line")
323  NVMEDIA_ICP_ERROR(VI, EMB_MISSING_LE, 0x0105, "Two LS packets were detected without a LE packet between them in emb data")
324  NVMEDIA_ICP_ERROR(VI, EMB_RUNAWAY, 0x0106, "More lines were received than expected in emb data")
325  NVMEDIA_ICP_ERROR(VI, EMB_SPURIOUS, 0x0107, "A pixel data packet was received without a LS packet first in emb data")
326  NVMEDIA_ICP_ERROR(VI, EMB_LONG_LINE, 0x0108, "More pixels were received than expected in a line in emb data")
327  NVMEDIA_ICP_ERROR(VI, EMB_INFRINGE, 0x0109, "Embedded data was received on a frame where no embedded data was expected")
328  NVMEDIA_ICP_ERROR(VI, DTYPE_MISMATCH, 0x010A, "The pixel datatype changed in the middle of the line")
330 
334 typedef struct {
335  /* Holds the CSI stream index. */
336  uint32_t csiStreamId;
337  /* Holds the CSI frame index generated by CSI Tx */
338  uint32_t csiFrameId;
339  /* Holds the virtual channel index. */
341  /* Holds the CSI error status. */
344 
358  NvMediaVersion *version
359 );
360 
374 NvMediaICPEx *
376  NvMediaICPSettingsEx *settings
377 );
378 
384 void
386  NvMediaICPEx *icpEx
387 );
388 
403  NvMediaICP *icp,
404  NvMediaImage *image,
405  uint32_t millisecondTimeout
406 );
407 
422  NvMediaICP *icp,
423  NvMediaImageGroup *imageGrp,
424  unsigned int millisecondTimeout
425 );
426 
443  NvMediaICP *icp
444 );
445 
460  NvMediaICP *icp);
461 
488  NvMediaICP *icp,
489  uint32_t millisecondTimeout,
490  NvMediaImage **image
491 );
492 
512  NvMediaICP *icp,
513  uint32_t millisecondTimeout,
514  NvMediaImageGroup **imageGrp
515 );
516 
533  NvMediaICP *icp,
534  NvMediaImage **image
535 );
536 
552  NvMediaICP *icp,
553  NvMediaImageGroup **imageGrp
554 );
555 
571  NvMediaICP *icp,
572  NvMediaICPErrorInfo *icpErrorInfo
573 );
574 
593  NvMediaICP *icp
594 );
595 
596 /*
597  * \defgroup history_nvmedia_icp History
598  * Provides change history for the NvMedia ICP API.
599  *
600  * \section history_nvmedia_icp Version History
601  *
602  * <b> Version 2.0 </b> April 4, 2016
603  * - Initial release
604  *
605  * <b> Version 2.1 </b> May 11, 2016
606  * - Added \ref NvMediaICPCheckVersion API
607  *
608  * <b> Version 2.2 </b> August 17, 2016
609  * - Added \ref NVMEDIA_IMAGE_CAPTURE_INPUT_FORMAT_TYPE_UYVY image capture input
610  * format type
611  *
612  * <b> Version 2.3 </b> August 31, 2016
613  * - Added option for enabling embeddedDataType in \ref NvMediaICPSettings
614  *
615  * <b> Version 2.4 </b> Jan 23, 2017
616  * - Added \ref NvMediaICPErrorInfo and \ref NvMediaICPGetErrorInfo
617  *
618  * <b> Version 2.5 </b> March 16, 2017
619  * - Added \ref NVMEDIA_IMAGE_CAPTURE_INPUT_FORMAT_TYPE_USER ,
620  * \ref NvMediaICPUserFormatType and option for enabling userFormatType in
621  * \ref NvMediaICPInputFormat
622  *
623  * <b> Version 3.0 </b> April 19, 2017
624  * Updated to use stdint.h instead of "unsigned int",
625  * "int", "unsigned short" and "char".
626  * NvMediaICPCreate and NvMediaICPDestroy are now deprecated.
627  * NvMediaICPGetFrame is now deprecated.
628  * NvMediaICPInterfaceFormat is now deprecated, it will be always CSI.
629  *
630  * <b> Version 3.1 </b> May 12, 2017
631  * - Added \ref NvMediaICPGetVersion API to get the version of NvMedia ICP library
632  * - NvMediaICPCheckVersion is deprecated. Use NvMediaICPGetVersion() instead
633  *
634  * <b> Version 3.2 </b> May 19, 2017
635  * Removed \ref NvMediaICPSurfaceFormatType
636  * NvMediaICPSettings now takes NvMediaSurfaceType to indicate capture surface format
637  * Removed NVMEDIA_IMAGE_CAPTURE_CSI_INTERFACE_TYPE_TPG0
638  * Combined NvMediaICPUserFormatType with NvMediaICPInputFormatType
639  * Removed NVMEDIA_IMAGE_CAPTURE_INPUT_FORMAT_TYPE_YUV420
640  * from \ref NvMediaICPInputFormatType
641  * Added RAW6/RAW7/RAW8/RAW10/RAW12/RAW14 in NvMediaICPInputFormatType
642  * Removed pixelOrder from \ref NvMediaICPInputFormat
643  * Added tpgEnagle in \ref NvMediaICPSettings
644  *
645  * <b> Version 4.2 </b> June 12, 2017
646  * Added virtualGroupIndex inside \ref NvMediaICPSettingsEx
647  * Renamed virtualChannel to virtualGroup inside \ref NvMediaICPEx
648  * Added \ref NvMediaICPFeedImageGroup and \ref NvMediaICPGetImageGroup APIs
649  *
650  * <b> Version 4.3 </b> October 5, 2017
651  * - Added \ref NvMediaICPResume API
652  *
653  * <b> Version 4.4 </b> October 11, 2017
654  * Changed the prototypes for \ref NvMediaICPGetImageGroup and
655  * \ref NvMediaICPReleaseImageGroup to accept double pointer to imageGrp
656  *
657  * <b> Version 4.5 </b> November 10, 2017
658  * Added YUV422_10, RAW16, RAW20 support in \ref NvMediaICPInputFormatType
659  * \ref NVMEDIA_IMAGE_CAPTURE_INPUT_FORMAT_TYPE_YUV422_10,
660  * \ref NVMEDIA_IMAGE_CAPTURE_INPUT_FORMAT_TYPE_RAW16,
661  * \ref NVMEDIA_IMAGE_CAPTURE_INPUT_FORMAT_TYPE_RAW20
662  *
663  * <b> Version 4.6 </b> November 18, 2017
664  * Added additional CSI interfaces, CSI phy mode parameter to \ref NvMediaICPSettingsEX
665  *
666  * <b> Version 4.7 </b> March 16, 2018
667  * Added mipiSpeed in \ref NvMediaICPSettings
668  *
669  * <b> Version 4.8 </b> September 12, 2018
670  * Added NvMediaICPWaitForSoF in \ref NvMediaICPWaitForSoF
671  *
672  */
675 #ifdef __cplusplus
676 }; /* extern "C" */
677 #endif
678 
679 #endif /* _NVMEDIA_ICP_H */
NvMediaICPInputFormat inputFormat
Holds the input format.
Definition: nvmedia_icp.h:188
A handle representing image objects.
Definition: nvmedia_image.h:75
NvMediaICPInterfaceType
Determines the image capture interface type for CSI interface.
Definition: nvmedia_icp.h:87
#define NvMediaSurfaceType
Defines the set of NvMedia surface types.
NvMediaStatus NvMediaICPFeedImageGroup(NvMediaICP *icp, NvMediaImageGroup *imageGrp, unsigned int millisecondTimeout)
Adds an image group to the image capture pool.
NvMediaStatus NvMediaICPFeedFrame(NvMediaICP *icp, NvMediaImage *image, uint32_t millisecondTimeout)
Adds an image to the image capture pool.
uint16_t thsSettle
Holds the MIPI THS-SETTLE time.
Definition: nvmedia_icp.h:209
NvMediaICPInputFormatType inputFormatType
Capture input format type.
Definition: nvmedia_icp.h:165
Input format type : User defined 6 (0x35)
Definition: nvmedia_icp.h:153
uint32_t NvMediaBool
A boolean value, holding NVMEDIA_TRUE or NVMEDIA_FALSE.
Definition: nvmedia_core.h:79
Input format type : User defined 4 (0x33)
Definition: nvmedia_icp.h:149
Holds image capture settings for the CSI format.
Definition: nvmedia_icp.h:184
Input format type : User defined 3 (0x32)
Definition: nvmedia_icp.h:147
NvMediaStatus NvMediaICPGetImageGroup(NvMediaICP *icp, uint32_t millisecondTimeout, NvMediaImageGroup **imageGrp)
Gets a captured image group with frame status.
Input format type : User defined 5 (0x34)
Definition: nvmedia_icp.h:151
NVIDIA Media Interface: Surface Handling
uint16_t width
Holds the capture width.
Definition: nvmedia_icp.h:192
NVIDIA Media Interface: Image Processing
NvMediaICPInterfaceType interfaceType
Holds the interface type.
Definition: nvmedia_icp.h:186
#define NVMEDIA_ICP_MAX_VIRTUAL_CHANNELS
Defines the maximum number of virtual channels per virtual group.
Definition: nvmedia_icp.h:56
NvMediaStatus NvMediaICPWaitForSoF(NvMediaICP *icp)
Waits for next SoF(Start of Frame).
Holds NvMedia Version information.
Definition: nvmedia_core.h:252
Holds the image capture settings for the CSI format.
Definition: nvmedia_icp.h:223
Input format type : User defined 7 (0x36)
Definition: nvmedia_icp.h:155
uint16_t startX
Holds the horizontal start position.
Definition: nvmedia_icp.h:196
Input format type : YUV 4:2:2 8bits.
Definition: nvmedia_icp.h:119
uint16_t embeddedDataLines
Holds the embedded data lines.
Definition: nvmedia_icp.h:200
uint16_t numVirtualGroups
Definition: nvmedia_icp.h:258
uint16_t startY
Holds the vertical start position.
Definition: nvmedia_icp.h:198
NvMediaICPSettings icpSettings
Definition: nvmedia_icp.h:235
#define NVMEDIA_ICP_MAX_VIRTUAL_GROUPS
Defines the maximum number of virtual groups.
Definition: nvmedia_icp.h:53
NvMediaBitsPerPixel bitsPerPixel
Number of bits per pixel It is used when the bits per pixel doesn't match with input format type...
Definition: nvmedia_icp.h:168
NvMediaStatus NvMediaICPResume(NvMediaICP *icp)
Resumes the image capture.
NvMediaICPEx * NvMediaICPCreateEx(NvMediaICPSettingsEx *settings)
Creates an image capture object used to capture various formats of input into an NvMediaImage.
NvMediaStatus NvMediaICPReleaseImageGroup(NvMediaICP *icp, NvMediaImageGroup **imageGrp)
Gets an image group from the internal pool that the client previously supplied with NvMediaICPFeedIma...
A handle representing an image group.
NVIDIA Media Interface: Core
NvMediaStatus
The set of all possible error codes.
Definition: nvmedia_core.h:199
Input format type : YUV 4:2:2 10bits.
Definition: nvmedia_icp.h:121
uint16_t numVirtualChannels
Holds the number of virtual channels per group.
Definition: nvmedia_icp.h:240
Capture input format.
Definition: nvmedia_icp.h:163
NvMediaICPCsiPhyMode phyMode
Holds the CSI phy mode.
Definition: nvmedia_icp.h:216
NvMediaStatus NvMediaICPGetErrorInfo(NvMediaICP *icp, NvMediaICPErrorInfo *icpErrorInfo)
Gets the capture error information.
Holds a rectangular region of a surface.
Definition: nvmedia_core.h:146
NvMediaRect clipRect
Definition: nvmedia_icp.h:237
Input format type : User defined 8 (0x37)
Definition: nvmedia_icp.h:157
NvMediaICPInputFormatType
Determines the image capture input format type.
Definition: nvmedia_icp.h:117
uint16_t virtualChannelIndex
Definition: nvmedia_icp.h:233
NvMediaICPErrorStatus errorStatus
Definition: nvmedia_icp.h:342
Holds the capture error information populated by NvMediaICPGetErrorInfo.
Definition: nvmedia_icp.h:334
NvMediaBool embeddedDataType
Holds the flag of embedded data type.
Definition: nvmedia_icp.h:212
uint16_t numVirtualGroups
Holds the number of virtual groups.
Definition: nvmedia_icp.h:243
NvMediaStatus NvMediaICPStop(NvMediaICP *icp)
Stops the image capture.
uint32_t pixelFrequency
Holds the pixel clock frequency.
Definition: nvmedia_icp.h:205
void NvMediaICP
Image capture object per virtual group.
Definition: nvmedia_icp.h:251
uint32_t interfaceLanes
Holds the number of CSI interface lanes active.
Definition: nvmedia_icp.h:202
uint32_t virtualChannelId
Definition: nvmedia_icp.h:340
NvMediaICPCsiPhyMode phyMode
Holds the CSI phy mode.
Definition: nvmedia_icp.h:245
NvMediaICPErrorStatus
Defines codes that describe error status.
Definition: nvmedia_icp.h:302
uint16_t height
Holds the capture height.
Definition: nvmedia_icp.h:194
Input format type : YUV 4:4:4.
Definition: nvmedia_icp.h:123
uint32_t interfaceLanes
Holds the number of active CSI interface lanes.
Definition: nvmedia_icp.h:229
NvMediaICPCsiPhyMode
Specifies CSI phy mode.
Definition: nvmedia_icp.h:174
NvMediaBitsPerPixel
Bits per pixel.
NvMediaStatus NvMediaICPGetFrameEx(NvMediaICP *icp, uint32_t millisecondTimeout, NvMediaImage **image)
Gets a captured frame with frame status.
uint16_t virtualGroupId
Definition: nvmedia_icp.h:261
Input format type : User defined 1 (0x30)
Definition: nvmedia_icp.h:143
Input format type : User defined 2 (0x31)
Definition: nvmedia_icp.h:145
uint32_t mipiSpeed
Holds the mipi speed in kHz.
Definition: nvmedia_icp.h:207
NvMediaICPInterfaceType interfaceType
Holds the interface type.
Definition: nvmedia_icp.h:225
NvMediaStatus NvMediaICPReleaseFrame(NvMediaICP *icp, NvMediaImage **image)
Gets a frame from the internal pool that the client previously supplied with NvMediaICPFeedFrame().
NvMediaICP * hIcp
Definition: nvmedia_icp.h:263
NvMediaSurfaceType surfaceType
Holds the capture surface type.
Definition: nvmedia_icp.h:190
NvMediaStatus NvMediaICPGetVersion(NvMediaVersion *version)
Checks the version compatibility for the NvMedia ICP library.
Holds the image capture object created by NvMediaICPCreateEx.
Definition: nvmedia_icp.h:256
uint8_t tpgEnable
TPG enabled.
Definition: nvmedia_icp.h:214
#define NVMEDIA_ICP_ERROR(_type_, _error_, _value_, _desc_)
Defines a macro that creates an enumerator in enum NvMediaICPErrorStatus.
Definition: nvmedia_icp.h:81
void NvMediaICPDestroyEx(NvMediaICPEx *icpEx)
Destroys the image capture object created by NvMediaICPCreateEx.