Loading [MathJax]/extensions/tex2jax.js
  • <xmp id="om0om">
  • <table id="om0om"><noscript id="om0om"></noscript></table>
  • NVIDIA DRIVE OS Linux SDK API Reference

    6.0.4 Release
    All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
    CDI Device Driver

    Detailed Description


    Usage considerations

    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(
    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:741
    NVMEDIA_STATUS_OK
    @ NVMEDIA_STATUS_OK
    Specifies that the operation completed successfully (with no error).
    Definition: nvmedia_core.h:107
    NvMediaStatus
    NvMediaStatus
    Defines all possible error codes.
    Definition: nvmedia_core.h:104
    NVMEDIA_STATUS_BAD_PARAMETER
    @ NVMEDIA_STATUS_BAD_PARAMETER
    Specifies that a bad parameter was passed.
    Definition: nvmedia_core.h:109
    devblk_cdi.h
    NVIDIA Device Block Interface: Camera Device Interface (CDI)
    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:743
    DevBlkCDIDevice::deviceDriverHandle
    void * deviceDriverHandle
    Definition: devblk_cdi.h:120
    人人超碰97caoporen国产