NVIDIA DriveOS Linux NSR SDK API Reference

7.0.3.0 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.
  • ParseTopEmbDataInfo (optional). Invoked when the client calls DevBlkCDIParseTopEmbDataInfo().
  • ParseTopEmbDataInfo (optional). Invoked when the client calls DevBlkCDIParseTopEmbDataInfo().
  • 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(
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:977
NVMEDIA_STATUS_OK
@ NVMEDIA_STATUS_OK
Specifies that the operation completed successfully (with no error).
Definition: nvmedia_core.h:111
NvMediaStatus
NvMediaStatus
Defines all possible error codes.
Definition: nvmedia_core.h:108
handle
const WFDCommitType const WFDHandle handle
Definition: wfdext.h:124
NVMEDIA_STATUS_BAD_PARAMETER
@ NVMEDIA_STATUS_BAD_PARAMETER
Specifies that a bad parameter was passed.
Definition: nvmedia_core.h:113
devblk_cdi.h
NVIDIA Device Block Interface: Camera Device Interface (CDI)
DevBlkCDIDevice
Holds the handles for an DevBlkCDIDevice object.
Definition: devblk_cdi.h:124
DevBlkCDIDeviceDriver::deviceName
const char * deviceName
Holds the device name.
Definition: devblk_cdi.h:979