NVIDIA DRIVE OS Linux SDK API Reference

6.0.3 Release
CDI Device Driver

Detailed Description

Program elements related to DevBlkCDIDeviceDriver, which defines a device driver. The core DevBlkCDI calls the driver when the client calls the related public DevBlkCDI function.

Before the client can create an DevBlkCDIDevice object (a device), it must provide a device driver. The DevBlkCDIDeviceDriver object contains the following data fields and function pointers.

Data Fields
  • deviceName The name of the device. This is a null-terminated string.
  • regLength Target device offset length in bytes. Valid Range: [1, 2].
  • dataLength Target device data length in bytes. Valid Range: [1, 2].
Function Pointers
  • DriverCreate (mandatory). Invoked when the client calls DevBlkCDIDeviceCreate().
  • DriverDestroy (mandatory). Invoked when the client calls DevBlkCDIDeviceDestroy().
  • GetModuleConfig (optional). Invoked when the client calls DevBlkCDIGetModuleConfig(). Not supported for safety use cases.
  • ParseEmbedDataInfo (optional). Invoked when the client calls DevBlkCDIParseEmbedDataInfo().
  • SetSensorControls (optional). Invoked when the client calls DevBlkCDISetSensorControls().
  • GetSensorAttributes (optional). Invoked when the client calls DevBlkCDIGetSensorAttributes().
  • SetSensorCharMode (optional). Invoked when the client calls DevBlkCDISetSensorCharMode(). Not supported for safety use cases.
  • ReadRegister (optional). Not supported for safety use cases.
  • WriteRegister (optional). Not supported for safety use cases.

Here is a sample device driver implementation. The source file defines the driver by creating an DevBlkCDIDeviceDriver struct and setting its function pointers. The header file provides a function that retrieves a pointer to the driver struct.

Header File
#include <devblk_cdi.h>
DevBlkCDIDeviceDriver *GetSAMPLEDEVICEDriver(void);

Source File

#include "cdi_sample_device.h"
DriverCreate(
DevBlkCDIDevice *handle,
void *clientContext)
{
if(!handle)
Can be used to maintain local device context
or can be set to NULL.
handle->deviceDriverHandle = NULL;
}
static DevBlkCDIDeviceDriver deviceDriver = {
.deviceName = "Sample Sensor Device",
.DriverCreate = DriverCreate
};
GetSAMPLEDEVICEDriver(void)
{
Return device driver descriptor structure
return &deviceDriver;
}

Data Structures

struct  DevBlkCDIDeviceDriver
 Holds device driver data. More...
 
DevBlkCDIDeviceDriver
Holds device driver data.
Definition: devblk_cdi.h:604
NVMEDIA_STATUS_OK
@ NVMEDIA_STATUS_OK
Specifies that the operation completed successfully (with no error).
Definition: tvmr/include/nvmedia_core.h:183
NVMEDIA_STATUS_BAD_PARAMETER
@ NVMEDIA_STATUS_BAD_PARAMETER
Specifies that a bad parameter was passed.
Definition: tvmr/include/nvmedia_core.h:185
devblk_cdi.h
NVIDIA Device Block Interface: Camera Device Interface (CDI)
NvMediaStatus
NvMediaStatus
Defines all possible error codes.
Definition: tvmr/include/nvmedia_core.h:180
DevBlkCDIDevice
Holds the handle for an DevBlkCDIDevice object.
Definition: devblk_cdi.h:119
DevBlkCDIDeviceDriver::deviceName
const char * deviceName
Holds the device name.
Definition: devblk_cdi.h:606
DevBlkCDIDevice::deviceDriverHandle
void * deviceDriverHandle
Definition: devblk_cdi.h:120