NVIDIA DRIVE OS Linux SDK API Reference

6.0.4 Release
devblk_cdi.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2022, 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 DEVBLK_CDI_H
16 #define DEVBLK_CDI_H
17 
18 #include "nvmedia_core.h"
19 #include "NvSIPLCapStructs.h"
20 #include "NvSIPLCDICommon.h"
21 
22 #ifndef __cplusplus
23 #include <stdbool.h>
24 #endif
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
55 #define DEVBLK_CDI_SIMULATOR_ADDRESS 0xFF1U
56 
57 #define RDEV_CFG_I2C_BITS 8
58 
59 #define RDEV_CFG_CSI_BITS (RDEV_CFG_I2C_BITS + 8)
60 
61 #define RDEV_CFG_SLV_BIT (RDEV_CFG_CSI_BITS + 1)
62 
68 #define CDI_RDEV_CFG(csi, i2c) (((uint32_t)(csi) << (uint32_t)RDEV_CFG_I2C_BITS) | (i2c))
69 
86 #define CDI_RDEV_CFG_EX(csi, i2c, disPwrCtrl) \
87  ((i2c & 0xffU) | \
88  ((uint32_t)(csi & 0xffU) << (uint32_t)RDEV_CFG_I2C_BITS) | \
89  ((uint32_t)(disPwrCtrl & 1U) << (uint32_t)RDEV_CFG_SLV_BIT))
90 
98 #define CDI_SLV_RDEV_CFG(csi, i2c) \
99  ((i2c) | ((uint32_t)(csi) << RDEV_CFG_I2C_BITS) | ((uint32_t)(1U) << RDEV_CFG_CSI_BITS))
100 
101 
103 
104 struct DevBlkCDIEmbeddedDataChunk;
105 
106 struct DevBlkCDIEmbeddedDataInfo;
107 
108 struct DevBlkCDISensorAttributes;
109 
110 #if !NV_IS_SAFETY
111 struct DevBlkCDIModuleConfig;
112 #endif
113  /* Ends Basic CDI Types group */
115 
119 typedef struct {
122 
138 typedef enum {
153 
157 #define DEVBLK_CDI_ROOT_DEVICE_MAX_GPIOS (8U)
158 
162 typedef struct {
169  uint32_t count;
171 
175 typedef struct {
177  uint8_t method;
181  uint8_t i2cAddr;
183 
184 
192 #define DEVBLK_CDI_GPIO_LEVEL_LOW (1U)
193 #define DEVBLK_CDI_GPIO_LEVEL_HIGH (2U)
194 
199 typedef enum {
225 
229 typedef void DevBlkCDIRootDevice;
230 
308 DevBlkCDIRootDeviceCreate(
309  uint32_t portCfg,
310  DevBlkCDIGPIOIndices gpios,
311  const bool useCDIv2API
312 );
314 
346 void
348 DevBlkCDIRootDeviceDestroy(
349  DevBlkCDIRootDevice *device
350 );
352 
395  DevBlkCDIRootDevice const *device,
396  uint32_t gpio_idx,
397  uint32_t *level
398 );
399 
442  DevBlkCDIRootDevice const *device,
443  uint32_t gpio_idx,
444  uint32_t level
445 );
446 
485  DevBlkCDIRootDevice const *device,
486  uint32_t gpio_idx
487 );
488 
549 DevBlkCDIRootDeviceWaitForError(
550  DevBlkCDIRootDevice const *device,
551  DevBlkCDIGPIOIndices *gpios
552 );
554 
594  DevBlkCDIRootDevice const *device,
595  uint32_t gpio_idx,
596  DevBlkCDIGpioEvent *event_code
597 );
598 
638 DevBlkCDIRootDeviceAbortWaitForError(
639  DevBlkCDIRootDevice const *device
640 );
642 
741 typedef struct {
743  const char *deviceName;
745  uint32_t regLength;
747  uint32_t dataLength;
748 
782  NvMediaStatus (* DriverCreate)(
783  DevBlkCDIDevice *handle,
784  void const* clientContext);
785 
814  NvMediaStatus (* DriverDestroy)(
815  DevBlkCDIDevice *handle);
816 
865  NvMediaStatus (* SetSensorControls)(
866  DevBlkCDIDevice const* handle,
867  const struct DevBlkCDISensorControl *sensorControl,
868  const size_t sensrCtrlStructSize);
869 
905  NvMediaStatus (* ParseTopEmbDataInfo)(
906  DevBlkCDIDevice const* handle,
907  const struct DevBlkCDIEmbeddedDataChunk *topEmbDataChunk,
908  const size_t topChunkStructSize,
909  struct DevBlkCDIEmbeddedDataInfo *embeddedDataInfo,
910  const size_t dataInfoStructSize);
911 
960  NvMediaStatus (* ParseBotEmbDataInfo)(
961  DevBlkCDIDevice const* handle,
962  const struct DevBlkCDIEmbeddedDataChunk *botEmbDataChunk,
963  const size_t botChunkStructSize,
964  struct DevBlkCDIEmbeddedDataInfo *embeddedDataInfo,
965  const size_t dataInfoStructSize);
966 
1000  NvMediaStatus (* GetSensorAttributes)(
1001  DevBlkCDIDevice const* handle,
1002  struct DevBlkCDISensorAttributes *sensorAttr,
1003  const size_t sensorAttrStructSize);
1004 
1005 #if !NV_IS_SAFETY
1006 
1025  NvMediaStatus (* GetModuleConfig)(
1026  DevBlkCDIDevice *handle,
1027  struct DevBlkCDIModuleConfig *moduleConfig);
1028 
1084  NvMediaStatus (* SetSensorCharMode)(
1085  DevBlkCDIDevice *handle,
1086  uint8_t expNo);
1087 #endif
1088 
1109  NvMediaStatus (* ReadRegister)(
1110  DevBlkCDIDevice const* handle,
1111  uint32_t deviceIndex,
1112  uint32_t registerNum,
1113  uint32_t dataLength,
1114  uint8_t *dataBuff);
1115 
1136  NvMediaStatus (* WriteRegister)(
1137  DevBlkCDIDevice const* handle,
1138  uint32_t deviceIndex,
1139  uint32_t registerNum,
1140  uint32_t dataLength,
1141  uint8_t const* dataBuff);
1142 
1144 
1159 typedef struct {
1163 
1223 DevBlkCDIDeviceCreate(
1224  DevBlkCDIRootDevice *rootDevice,
1225  uint32_t *deviceAddressList,
1226  uint32_t numDevices,
1227  DevBlkCDIDeviceDriver *deviceDriverParam,
1228  DevBlkCDIAdvancedConfig const *advancedConfig,
1229  uint8_t linkIndex,
1230  NvSiplBool isDeserializer,
1231  NvSiplBool useNativeI2CAddress,
1232  NvSiplBool useCDIv2API
1233 );
1235 
1267 void
1269 DevBlkCDIDeviceDestroy(
1270  DevBlkCDIDevice *device
1271 );
1273 
1313  DevBlkCDIDevice const *device,
1314  uint32_t deviceIndex,
1315  uint32_t regLength,
1316  uint8_t *regData,
1317  uint32_t dataLength,
1318  uint8_t *data
1319 );
1320 
1359  DevBlkCDIDevice const *device,
1360  uint32_t deviceIndex,
1361  uint32_t dataLength,
1362  const uint8_t *data
1363 );
1364 
1406  DevBlkCDIDevice *device,
1407  DevBlkCDISensorAttributes *sensorAttr,
1408  const size_t sensorAttrStructSize);
1409 
1426 typedef struct DevBlkCDISensorControl {
1437 
1441  DevBlkCDIExposure exposureControl[DEVBLK_CDI_MAX_SENSOR_CONTEXTS];
1442 
1446  DevBlkCDIWhiteBalance wbControl[DEVBLK_CDI_MAX_SENSOR_CONTEXTS];
1447 
1454  DevBlkCDIFrameReport frameReportControl;
1455 
1457 
1501  DevBlkCDIDevice *device,
1502  const DevBlkCDISensorControl *sensorControl,
1503  const size_t sensrCtrlStructSize
1504 );
1505 
1558  DevBlkCDIDevice *device,
1559  const DevBlkCDIEmbeddedDataChunk *embeddedTopDataChunk,
1560  const size_t embeddedDataChunkStructSize,
1561  DevBlkCDIEmbeddedDataInfo *embeddedDataInfo,
1562  const size_t dataInfoStructSize);
1563 
1566  DevBlkCDIDevice *device,
1567  const DevBlkCDIEmbeddedDataChunk *embeddedBotDataChunk,
1568  const size_t embeddedDataChunkStructSize,
1569  DevBlkCDIEmbeddedDataInfo *embeddedDataInfo,
1570  const size_t dataInfoStructSize);
1571 
1584  DevBlkCDIRootDevice const *device);
1585 
1600  DevBlkCDIDevice *device,
1601  DevBlkCDIPowerControlInfo *desPwrControlInfo);
1602 
1617  DevBlkCDIDevice *device,
1618  DevBlkCDIPowerControlInfo *camPwrControlInfo);
1619 
1622 #if !NV_IS_SAFETY
1623 
1627 typedef enum {
1639 
1644 typedef struct DevBlkCDIModuleConfig {
1651 
1704  DevBlkCDIDevice *device,
1705  uint8_t expNo);
1706 
1738  DevBlkCDIDevice *device,
1739  DevBlkCDIModuleConfig *moduleConfig);
1740 
1741 #endif /* #if !NV_IS_SAFETY */
1742 
1745 #ifdef __cplusplus
1746 } /* extern "C" */
1747 #endif
1748 
1749 #endif /* DEVBLK_CDI_H */
DevBlkCDIPowerControlInfo::method
uint8_t method
Power control method.
Definition: devblk_cdi.h:177
DEVBLK_CDI_GPIO_EVENT_ERROR_BACKEND
@ DEVBLK_CDI_GPIO_EVENT_ERROR_BACKEND
An error occurred in backend code, potentially resulting in permanent loss of functionality.
Definition: devblk_cdi.h:218
DevBlkCDISensorControl
Holds the sensor control structure.
Definition: devblk_cdi.h:1426
DEVBLK_CDI_I2C_BUS_9
@ DEVBLK_CDI_I2C_BUS_9
Specifies i2c-9.
Definition: devblk_cdi.h:148
DEVBLK_CDI_PWR_LINK_3
@ DEVBLK_CDI_PWR_LINK_3
LINK 3 PWR.
Definition: devblk_cdi.h:1637
DevBlkCDIDeviceDriver::regLength
uint32_t regLength
Holds the target device offset length in bytes.
Definition: devblk_cdi.h:745
nvsipl::NvSiplBool
uint32_t NvSiplBool
A boolean value, holding SIPL_TRUE or SIPL_FALSE.
Definition: NvSIPLCommon.hpp:98
DEVBLK_CDI_I2C_BUS_11
@ DEVBLK_CDI_I2C_BUS_11
Specifies i2c-11.
Definition: devblk_cdi.h:150
DevBlkCDIDeviceWrite
NvMediaStatus DevBlkCDIDeviceWrite(DevBlkCDIDevice const *device, uint32_t deviceIndex, uint32_t dataLength, const uint8_t *data)
Performs a write operation over I2C.
DEVBLK_CDI_I2C_BUS_10
@ DEVBLK_CDI_I2C_BUS_10
Specifies i2c-10.
Definition: devblk_cdi.h:149
DevBlkCDIRootDeviceSetGPIOPinLevel
NvMediaStatus DevBlkCDIRootDeviceSetGPIOPinLevel(DevBlkCDIRootDevice const *device, uint32_t gpio_idx, uint32_t level)
Sets the logic level of Tegra GPIO output pin associated with this root device.
DevBlkCDIDeviceDriver
Holds device driver data.
Definition: devblk_cdi.h:741
DevBlkCDIGPIOIndices
Structure to hold array of CDAC GPIO indices.
Definition: devblk_cdi.h:162
DevBlkCDIParseTopEmbDataInfo
NvMediaStatus DevBlkCDIParseTopEmbDataInfo(DevBlkCDIDevice *device, const DevBlkCDIEmbeddedDataChunk *embeddedTopDataChunk, const size_t embeddedDataChunkStructSize, DevBlkCDIEmbeddedDataInfo *embeddedDataInfo, const size_t dataInfoStructSize)
Parses sensor embedded data info and provides sensor image settings information for the captured fram...
DevBlkCDISensorControl::numSensorContexts
uint8_t numSensorContexts
Holds the number of sensor contexts to activate.
Definition: devblk_cdi.h:1436
DevBlkCDISetSensorCharMode
NvMediaStatus DevBlkCDISetSensorCharMode(DevBlkCDIDevice *device, uint8_t expNo)
Set sensor in characterization mode.
NvMediaStatus
NvMediaStatus
Defines all possible error codes.
Definition: nvmedia_core.h:104
DevBlkCDISensorControl::wbControl
DevBlkCDIWhiteBalance wbControl[DEVBLK_CDI_MAX_SENSOR_CONTEXTS]
Holds the sensor white balance settings to set for each context.
Definition: devblk_cdi.h:1446
DevBlkCDIRootDeviceCheckAndClearIntr
NvMediaStatus DevBlkCDIRootDeviceCheckAndClearIntr(DevBlkCDIRootDevice const *device, uint32_t gpio_idx)
Verifies that the level of a GPIO pin configured as an interrupt is at the correct pre-transition lev...
DEVBLK_CDI_I2C_SIMULATOR
@ DEVBLK_CDI_I2C_SIMULATOR
Port SIMULATOR (20)
Definition: devblk_cdi.h:151
DevBlkCDIRootDeviceGetGPIOPinLevel
NvMediaStatus DevBlkCDIRootDeviceGetGPIOPinLevel(DevBlkCDIRootDevice const *device, uint32_t gpio_idx, uint32_t *level)
Queries the logic level of a Tegra GPIO input pin associated with the root device.
DEVBLK_CDI_I2C_BUS_7
@ DEVBLK_CDI_I2C_BUS_7
Specifies i2c-7.
Definition: devblk_cdi.h:146
DEVBLK_CDI_GPIO_EVENT_INTR
@ DEVBLK_CDI_GPIO_EVENT_INTR
An interrupt has occurred.
Definition: devblk_cdi.h:203
DevBlkCDIGetDesPowerControlInfo
NvMediaStatus DevBlkCDIGetDesPowerControlInfo(DevBlkCDIDevice *device, DevBlkCDIPowerControlInfo *desPwrControlInfo)
Get the deserialzer's power control information.
DevBlkCDIAdvancedConfig
Holds the description of the target I2C device.
Definition: devblk_cdi.h:1159
DEVBLK_CDI_I2C_BUS_3
@ DEVBLK_CDI_I2C_BUS_3
Specifies i2c-3.
Definition: devblk_cdi.h:142
DevBlkCDIParseBotEmbDataInfo
NvMediaStatus DevBlkCDIParseBotEmbDataInfo(DevBlkCDIDevice *device, const DevBlkCDIEmbeddedDataChunk *embeddedBotDataChunk, const size_t embeddedDataChunkStructSize, DevBlkCDIEmbeddedDataInfo *embeddedDataInfo, const size_t dataInfoStructSize)
DEVBLK_CDI_GPIO_EVENT_ERROR_WAIT_CANCELLED
@ DEVBLK_CDI_GPIO_EVENT_ERROR_WAIT_CANCELLED
Waiting for an interrupt was unexpectedly cancelled, potentially resulting in permanent loss of funct...
Definition: devblk_cdi.h:208
DEVBLK_CDI_PWR_LINK_0
@ DEVBLK_CDI_PWR_LINK_0
LINK 0 Power.
Definition: devblk_cdi.h:1631
NvSIPLCapStructs.h
DEVBLK_CDI_GPIO_EVENT_ERROR_UNKNOWN
@ DEVBLK_CDI_GPIO_EVENT_ERROR_UNKNOWN
A generic error occurred, potentially resulting in permanent loss of functionality.
Definition: devblk_cdi.h:223
DevBlkCDIModuleConfig::cameraModuleConfigPass2
const char * cameraModuleConfigPass2
Definition: devblk_cdi.h:1649
DevBlkCDIGetCamPowerControlInfo
NvMediaStatus DevBlkCDIGetCamPowerControlInfo(DevBlkCDIDevice *device, DevBlkCDIPowerControlInfo *camPwrControlInfo)
Get the camera's power control information.
DEVBLK_CDI_GPIO_EVENT_ERROR_CDAC
@ DEVBLK_CDI_GPIO_EVENT_ERROR_CDAC
An error occurred in CDAC code, potentially resulting in permanent loss of functionality.
Definition: devblk_cdi.h:213
DEVBLK_CDI_PWR_LINK_1
@ DEVBLK_CDI_PWR_LINK_1
LINK 1 PWR.
Definition: devblk_cdi.h:1633
DEVBLK_CDI_PWR_LINK_2
@ DEVBLK_CDI_PWR_LINK_2
LINK 2 PWR.
Definition: devblk_cdi.h:1635
DevBlkCDIDeviceRead
NvMediaStatus DevBlkCDIDeviceRead(DevBlkCDIDevice const *device, uint32_t deviceIndex, uint32_t regLength, uint8_t *regData, uint32_t dataLength, uint8_t *data)
Usage considerations
DevBlkCDIGPIOIndices::count
uint32_t count
Number of items in indices in gpio_idxs.
Definition: devblk_cdi.h:169
DevBlkCDISensorControl::exposureControl
DevBlkCDIExposure exposureControl[DEVBLK_CDI_MAX_SENSOR_CONTEXTS]
Holds the sensor exposure settings to set for each context.
Definition: devblk_cdi.h:1441
DevBlkCDIPowerItems
DevBlkCDIPowerItems
CDI Power control items.
Definition: devblk_cdi.h:1627
DevBlkCDIGetSensorAttributes
NvMediaStatus DevBlkCDIGetSensorAttributes(DevBlkCDIDevice *device, DevBlkCDISensorAttributes *sensorAttr, const size_t sensorAttrStructSize)
Queries the sensor attributes.
nvmedia_core.h
NVIDIA Media Interface: Core
DevBlkCDIGpioEvent
DevBlkCDIGpioEvent
CDI codes for CDAC GPIO Interrupt Events.
Definition: devblk_cdi.h:199
DEVBLK_CDI_I2C_BUS_1
@ DEVBLK_CDI_I2C_BUS_1
Specifies i2c-1.
Definition: devblk_cdi.h:140
DEVBLK_CDI_I2C_BUS_5
@ DEVBLK_CDI_I2C_BUS_5
Specifies i2c-5.
Definition: devblk_cdi.h:144
DevBlkCDIModuleConfig::cameraModuleCfgName
char cameraModuleCfgName[128]
Holds the camera module name.
Definition: devblk_cdi.h:1646
DevBlkCDIModuleConfig
struct DevBlkCDIModuleConfig DevBlkCDIModuleConfig
Holds the CDI Module ISP configuration.
DevBlkCDIPowerControlInfo::i2cAddr
uint8_t i2cAddr
power controller i2c slave address.
Definition: devblk_cdi.h:181
DEVBLK_CDI_I2C_BUS_0
@ DEVBLK_CDI_I2C_BUS_0
Specifies i2c-0.
Definition: devblk_cdi.h:139
DevBlkCDIPowerControlInfo
Structure to hold power control information.
Definition: devblk_cdi.h:175
DevBlkCDIGetModuleConfig
NvMediaStatus DevBlkCDIGetModuleConfig(DevBlkCDIDevice *device, DevBlkCDIModuleConfig *moduleConfig)
Gets the Module ISP configuration.
DEVBLK_CDI_GPIO_EVENT_NOTHING
@ DEVBLK_CDI_GPIO_EVENT_NOTHING
There is no pending event.
Definition: devblk_cdi.h:201
DevBlkCDIEnableErrorReport
NvMediaStatus DevBlkCDIEnableErrorReport(DevBlkCDIRootDevice const *device)
Enable the error report.
DevBlkCDISetSensorControls
NvMediaStatus DevBlkCDISetSensorControls(DevBlkCDIDevice *device, const DevBlkCDISensorControl *sensorControl, const size_t sensrCtrlStructSize)
Sets sensor control parameters.
DevBlkCDIRootDeviceGetGpioIntrEvent
NvMediaStatus DevBlkCDIRootDeviceGetGpioIntrEvent(DevBlkCDIRootDevice const *device, uint32_t gpio_idx, DevBlkCDIGpioEvent *event_code)
Usage considerations
DEVBLK_CDI_I2C_BUS_8
@ DEVBLK_CDI_I2C_BUS_8
Specifies i2c-8.
Definition: devblk_cdi.h:147
DevBlkCDISensorControl
struct DevBlkCDISensorControl DevBlkCDISensorControl
Holds the sensor control structure.
DevBlkCDIRootDevice
void DevBlkCDIRootDevice
An opaque handle for an DevBlkCDIRootDevice object.
Definition: devblk_cdi.h:229
DevBlkCDI_I2CPort
DevBlkCDI_I2CPort
Defines the I2C buses on the host hardware device.
Definition: devblk_cdi.h:138
DevBlkCDIDevice
Holds the handle for an DevBlkCDIDevice object.
Definition: devblk_cdi.h:119
DevBlkCDIModuleConfig
Holds the CDI Module ISP configuration.
Definition: devblk_cdi.h:1644
DEVBLK_CDI_ROOT_DEVICE_MAX_GPIOS
#define DEVBLK_CDI_ROOT_DEVICE_MAX_GPIOS
The maximum number of GPIOs supported on a CDI Root Device.
Definition: devblk_cdi.h:157
DevBlkCDIModuleConfig::cameraModuleConfigPass1
const char * cameraModuleConfigPass1
Holds the camera-specific configuration string.
Definition: devblk_cdi.h:1648
DevBlkCDIDeviceDriver::deviceName
const char * deviceName
Holds the device name.
Definition: devblk_cdi.h:743
DEVBLK_CDI_I2C_BUS_4
@ DEVBLK_CDI_I2C_BUS_4
Specifies i2c-4.
Definition: devblk_cdi.h:143
DevBlkCDIAdvancedConfig::clientContext
void * clientContext
Holds the client context.
Definition: devblk_cdi.h:1161
DEVBLK_CDI_PWR_AGGREGATOR
@ DEVBLK_CDI_PWR_AGGREGATOR
Aggregator Power.
Definition: devblk_cdi.h:1629
DEVBLK_CDI_I2C_BUS_2
@ DEVBLK_CDI_I2C_BUS_2
Specifies i2c-2.
Definition: devblk_cdi.h:141
DevBlkCDIDevice::deviceDriverHandle
void * deviceDriverHandle
Definition: devblk_cdi.h:120
DEVBLK_CDI_I2C_BUS_6
@ DEVBLK_CDI_I2C_BUS_6
Specifies i2c-6.
Definition: devblk_cdi.h:145
DevBlkCDISensorControl::frameReportControl
DevBlkCDIFrameReport frameReportControl
Holds the sensor frame report value to be programmed.
Definition: devblk_cdi.h:1454
DevBlkCDIDeviceDriver::dataLength
uint32_t dataLength
Holds the target device data length in bytes.
Definition: devblk_cdi.h:747