Loading [MathJax]/jax/input/TeX/config.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
    Camera Device Interface I2C Programmer

    Detailed Description

    The Camera Device Interface I2C Programmer API encompasses all I2C related functions for programming all I2C controlled components such as deserializers, serializers, EEPROMs, and image sensors.

    Data Structures

    struct  DevBlkCDII2CReg
     Defines the I2C address/data pair and an optional delay. More...
     
    struct  DevBlkCDII2CRegList
     Defines the I2C register table to write to the device. More...
     
    struct  DevBlkCDII2CRegListWritable
     Defines the I2C register table to read from the device. More...
     

    Macros

    #define I2C_ARRAY_SIZE(x)   (uint32_t)(sizeof(x) / sizeof((x)[0]))
     Macro for determining the number of address/data pairs in a register table. More...
     

    Typedefs

    typedef void * DevBlkCDII2CPgmr
     An opaque handle for an I2C programmer object. More...
     

    Functions

    DevBlkCDII2CPgmr DevBlkCDII2CPgmrCreate (DevBlkCDIDevice *handle, const uint8_t addrLength, const uint8_t dataLength)
     Creates an I2C Programmer to read/write I2C registers of a device. More...
     
    void DevBlkCDII2CPgmrDestroy (DevBlkCDII2CPgmr i2cProgrammer)
     Destroys an I2C Programmer. More...
     
    NvMediaStatus DevBlkCDII2CPgmrWriteUint8 (DevBlkCDII2CPgmr i2cProgrammer, const uint16_t address, const uint8_t data)
     Writes 8-bit data to an I2C register. More...
     
    NvMediaStatus DevBlkCDII2CPgmrWriteUint16 (DevBlkCDII2CPgmr i2cProgrammer, const uint16_t address, const uint16_t data)
     Writes 16-bit data to an I2C register. More...
     
    NvMediaStatus DevBlkCDII2CPgmrReadUint8 (DevBlkCDII2CPgmr i2cProgrammer, const uint16_t address, uint8_t *data)
     Reads 8-bit data from an I2C register. More...
     
    NvMediaStatus DevBlkCDII2CPgmrReadUint16 (DevBlkCDII2CPgmr i2cProgrammer, const uint16_t address, uint16_t *data)
     Reads 16-bit data from an I2C register. More...
     
    NvMediaStatus DevBlkCDII2CPgmrWriteArray (DevBlkCDII2CPgmr i2cProgrammer, const DevBlkCDII2CRegList *regList)
     Performs write operation for a register table. More...
     
    NvMediaStatus DevBlkCDII2CPgmrReadArray (DevBlkCDII2CPgmr i2cProgrammer, const DevBlkCDII2CRegListWritable *regList)
     Performs read operation for a register table. More...
     
    NvMediaStatus DevBlkCDII2CPgmrReadBlock (DevBlkCDII2CPgmr i2cProgrammer, const uint16_t address, const uint16_t dataLength, uint8_t *dataBuff)
     Reads a block of data from I2C device. More...
     
    NvMediaStatus DevBlkCDII2CPgmrDumpArray (DevBlkCDII2CPgmr i2cProgrammer, const DevBlkCDII2CRegList *regList)
     Dumps the values for all registers in the register table. More...
     
    NvMediaStatus DevBlkCDII2CPgmrDebugLogControl (DevBlkCDII2CPgmr i2cProgrammer, NvMediaBool enable)
     Enables debug logs for I2C Programmer. More...
     

    Macro Definition Documentation

    ◆ I2C_ARRAY_SIZE

    #define I2C_ARRAY_SIZE (   x)    (uint32_t)(sizeof(x) / sizeof((x)[0]))

    Macro for determining the number of address/data pairs in a register table.

    This macro should be used by the device driver to set DevBlkCDII2CRegList::numRegs.

    Do not use this macro when referencing register tables through pointers, otherwise the wrong number of address/data pairs will be returned.

    Definition at line 36 of file devblk_cdi_i2c.h.

    Typedef Documentation

    ◆ DevBlkCDII2CPgmr

    typedef void* DevBlkCDII2CPgmr

    An opaque handle for an I2C programmer object.

    Definition at line 92 of file devblk_cdi_i2c.h.

    Function Documentation

    ◆ DevBlkCDII2CPgmrCreate()

    DevBlkCDII2CPgmr DevBlkCDII2CPgmrCreate ( DevBlkCDIDevice handle,
    const uint8_t  addrLength,
    const uint8_t  dataLength 
    )

    Creates an I2C Programmer to read/write I2C registers of a device.

    This API does the following:

    1. Verifies all the input parameters.
    2. Allocates and initializes the context for the I2C Programmer.
    3. Returns the handle of the new I2C Programmer.
    Parameters
    [in]handleA pointer to the device that needs I2C access; Valid value: [non-NULL].
    [in]addrLengthI2C register address length in bytes; Valid range: [1, 2].
    [in]dataLengthI2C register data length in bytes; Valid range: [1, 2].
    Returns
    An opaque handle of an I2C programmer object.


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: No
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: Yes, with the following conditions:
      • Grants: nonroot, allow
      • Abilities: public_channel
      • Application needs to have access to the SGIDs that SIPL depends on as mentioned in the NVIDIA DRIVE OS Safety Developer Guide
    • API group
      • Init: Yes
      • Runtime: No
      • De-Init: No

    ◆ DevBlkCDII2CPgmrDebugLogControl()

    NvMediaStatus DevBlkCDII2CPgmrDebugLogControl ( DevBlkCDII2CPgmr  i2cProgrammer,
    NvMediaBool  enable 
    )

    Enables debug logs for I2C Programmer.

    Parameters
    [in]i2cProgrammerDevice handle for I2C Programmer.
    [in]enableflag to enable/disable debug logs.
    Return values
    NVMEDIA_STATUS_OKIf enable/disable debug log is successful.
    NVMEDIA_STATUS_BAD_PARAMETERIf one or more params was NULL or invalid.


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: No
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: Yes, with the following conditions:
      • Grants: nonroot, allow
      • Abilities: public_channel
      • Application needs to have access to the SGIDs that SIPL depends on as mentioned in the NVIDIA DRIVE OS Safety Developer Guide
    • API group
      • Init: Yes
      • Runtime: No
      • De-Init: No

    ◆ DevBlkCDII2CPgmrDestroy()

    void DevBlkCDII2CPgmrDestroy ( DevBlkCDII2CPgmr  i2cProgrammer)

    Destroys an I2C Programmer.

    This API does the following:

    1. Releases all the resources allocated when the I2C Programmer is created.
    Parameters
    [in]i2cProgrammerAn opaque handle for I2C Programmer to destroy. Valid value: [non-NULL].


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: No
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: Yes, with the following conditions:
      • Grants: nonroot, allow
      • Abilities: public_channel
      • Application needs to have access to the SGIDs that SIPL depends on as mentioned in the NVIDIA DRIVE OS Safety Developer Guide
    • API group
      • Init: No
      • Runtime: No
      • De-Init: Yes

    ◆ DevBlkCDII2CPgmrDumpArray()

    NvMediaStatus DevBlkCDII2CPgmrDumpArray ( DevBlkCDII2CPgmr  i2cProgrammer,
    const DevBlkCDII2CRegList regList 
    )

    Dumps the values for all registers in the register table.

    The register table consists of multiple register address/data pairs. This function will dump the I2C regsister value for each address/data pair for debugging purpose.

    Parameters
    [in]i2cProgrammerAn opaque handle for I2C Programmer.
    [in]regListPointer to the register table.
    Return values
    NVMEDIA_STATUS_OKIf read from register is successful.
    NVMEDIA_STATUS_BAD_PARAMETERIf one or more params was NULL or invalid.
    NVMEDIA_STATUS_ERRORIf the devctl IPC call to CDAC device node failed.


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: No
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: Yes, with the following conditions:
      • Grants: nonroot, allow
      • Abilities: public_channel
      • Application needs to have access to the SGIDs that SIPL depends on as mentioned in the NVIDIA DRIVE OS Safety Developer Guide
    • API group
      • Init: Yes
      • Runtime: Yes
      • De-Init: Yes

    ◆ DevBlkCDII2CPgmrReadArray()

    NvMediaStatus DevBlkCDII2CPgmrReadArray ( DevBlkCDII2CPgmr  i2cProgrammer,
    const DevBlkCDII2CRegListWritable regList 
    )

    Performs read operation for a register table.

    This function calls CDAC to read each of the registers in a register table.

    The register table consists of multiple register address/data pairs. This function will use the address/data pair information to read a sequence of I2C register values. To improve efficiency, this function batches reads from the hardware in one of two situations:

    • The batch size reaches MAX_BATCH_SIZE.
    • The final entry in the register list has been reached.
    Note
    In order to store the read register values, the register table should be declared using DevBlkCDII2CRegListWritable structure.
    Parameters
    [in]i2cProgrammerAn opaque handle for I2C Programmer; Valid value: [non-NULL].
    [out]regListA pointer to the writable register table. Valid value: [non-NULL].
    Return values
    NVMEDIA_STATUS_OKIf read from register is successful.
    NVMEDIA_STATUS_BAD_PARAMETERIf one or more params was NULL or invalid.
    NVMEDIA_STATUS_ERRORIf the devctl IPC call to CDAC device node failed.


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: No
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: Yes, with the following conditions:
      • Grants: nonroot, allow
      • Abilities: public_channel
      • Application needs to have access to the SGIDs that SIPL depends on as mentioned in the NVIDIA DRIVE OS Safety Developer Guide
    • API group
      • Init: Yes
      • Runtime: Yes
      • De-Init: Yes

    ◆ DevBlkCDII2CPgmrReadBlock()

    NvMediaStatus DevBlkCDII2CPgmrReadBlock ( DevBlkCDII2CPgmr  i2cProgrammer,
    const uint16_t  address,
    const uint16_t  dataLength,
    uint8_t *  dataBuff 
    )

    Reads a block of data from I2C device.

    This function calls CDAC to read data from consecutive register addresses. It is best used for reading a block of data from devices like EEPROM.

    To improve performance, this function performs the I2C bulk read operation, by specifying the starting address and the length of data in bytes.

    Parameters
    [in]i2cProgrammerAn opaque handle for I2C Programmer; Valid value: [non-NULL].
    [in]address16-bit register address; Valid range: [0, UINT16_MAX].
    [in]dataLengthSize of the data to read; Valid range: [1, MAX_CDAC_I2C_BUFFER].
    [out]dataBuffA pointer to a buffer that must be bigger than dataLength bytes to hold all the read values from the device; Valid value: [non-NULL].
    Return values
    NVMEDIA_STATUS_OKIf read from register is successful.
    NVMEDIA_STATUS_BAD_PARAMETERIf one or more params was NULL or invalid.
    NVMEDIA_STATUS_ERRORIf the devctl IPC call to CDAC device node failed.


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: No
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: Yes, with the following conditions:
      • Grants: nonroot, allow
      • Abilities: public_channel
      • Application needs to have access to the SGIDs that SIPL depends on as mentioned in the NVIDIA DRIVE OS Safety Developer Guide
    • API group
      • Init: Yes
      • Runtime: Yes
      • De-Init: Yes

    ◆ DevBlkCDII2CPgmrReadUint16()

    NvMediaStatus DevBlkCDII2CPgmrReadUint16 ( DevBlkCDII2CPgmr  i2cProgrammer,
    const uint16_t  address,
    uint16_t *  data 
    )

    Reads 16-bit data from an I2C register.

    This API does the following:

    1. Verifies all the input parameters.
    2. Calls CDAC to read a 16-bit data from an I2C register.
    Parameters
    [in]i2cProgrammerAn opaque handle for I2C Programmer; Valid value: [non-NULL].
    [in]address16-bit register address; Valid range: [0, UINT16_MAX].
    [out]dataA pointer to a 16-bit buffer that holds the read value; Valid value: [non-NULL].
    Return values
    NVMEDIA_STATUS_OKIf read from register is successful.
    NVMEDIA_STATUS_BAD_PARAMETERIf one or more params was NULL or invalid.
    NVMEDIA_STATUS_ERRORIf the devctl IPC call to CDAC device node failed.


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: No
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: Yes, with the following conditions:
      • Grants: nonroot, allow
      • Abilities: public_channel
      • Application needs to have access to the SGIDs that SIPL depends on as mentioned in the NVIDIA DRIVE OS Safety Developer Guide
    • API group
      • Init: Yes
      • Runtime: Yes
      • De-Init: Yes

    ◆ DevBlkCDII2CPgmrReadUint8()

    NvMediaStatus DevBlkCDII2CPgmrReadUint8 ( DevBlkCDII2CPgmr  i2cProgrammer,
    const uint16_t  address,
    uint8_t *  data 
    )

    Reads 8-bit data from an I2C register.

    This API does the following:

    1. Verifies all the input parameters.
    2. Calls CDAC to read an 8-bit data from an I2C register.
    Parameters
    [in]i2cProgrammerAn opaque handle for I2C Programmer; Valid value: [non-NULL].
    [in]address16-bit register address; Valid range: [0, UINT16_MAX].
    [out]dataA pointer to an 8-bit buffer that holds the read value; Valid value: [non-NULL].
    Return values
    NVMEDIA_STATUS_OKIf read from register is successful.
    NVMEDIA_STATUS_BAD_PARAMETERIf one or more params was NULL or invalid.
    NVMEDIA_STATUS_ERRORIf the devctl IPC call to CDAC device node failed.


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: No
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: Yes, with the following conditions:
      • Grants: nonroot, allow
      • Abilities: public_channel
      • Application needs to have access to the SGIDs that SIPL depends on as mentioned in the NVIDIA DRIVE OS Safety Developer Guide
    • API group
      • Init: Yes
      • Runtime: Yes
      • De-Init: Yes

    ◆ DevBlkCDII2CPgmrWriteArray()

    NvMediaStatus DevBlkCDII2CPgmrWriteArray ( DevBlkCDII2CPgmr  i2cProgrammer,
    const DevBlkCDII2CRegList regList 
    )

    Performs write operation for a register table.

    This function calls CDAC to write each of the registers in a register table.

    The register table consists of multiple register address/data pairs. This function will use the address/data pair information to program a sequence of I2C registers. To improve efficiency, this function batches writes and flushes them to the hardware in one of three situations:

    • An entry in the register list has a delayUsec > 0. In this case the batch is immediately flushed and the thread is put to sleep for the specified time.
    • The batch size reaches MAX_BATCH_SIZE.
    • The final entry in the register list has been reached.
    Parameters
    [in]i2cProgrammerAn opaque handle for I2C Programmer; Valid value: [non-NULL].
    [in]regListA pointer to the register table; Valid value: [non-NULL].
    Return values
    NVMEDIA_STATUS_OKIf write to register is successful.
    NVMEDIA_STATUS_BAD_PARAMETERIf one or more params was NULL or invalid.
    NVMEDIA_STATUS_ERRORIf the devctl IPC call to CDAC device node failed.


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: No
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: Yes, with the following conditions:
      • Grants: nonroot, allow
      • Abilities: public_channel
      • Application needs to have access to the SGIDs that SIPL depends on as mentioned in the NVIDIA DRIVE OS Safety Developer Guide
    • API group
      • Init: Yes
      • Runtime: Yes
      • De-Init: Yes

    ◆ DevBlkCDII2CPgmrWriteUint16()

    NvMediaStatus DevBlkCDII2CPgmrWriteUint16 ( DevBlkCDII2CPgmr  i2cProgrammer,
    const uint16_t  address,
    const uint16_t  data 
    )

    Writes 16-bit data to an I2C register.

    This API does the following:

    1. Verifies all the input parameters.
    2. Calls CDAC to write a 16-bit data to an I2C register.
    Parameters
    [in]i2cProgrammerAn opaque handle for I2C Programmer; Valid value: [non-NULL].
    [in]address16-bit register address; Valid range: [0, UINT16_MAX].
    [in]data16-bit register data; Valid range: [0, UINT16_MAX].
    Return values
    NVMEDIA_STATUS_OKIf write to register is successful.
    NVMEDIA_STATUS_BAD_PARAMETERIf one or more params was NULL or invalid.
    NVMEDIA_STATUS_ERRORIf the devctl IPC call to CDAC device node failed.


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: No
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: Yes, with the following conditions:
      • Grants: nonroot, allow
      • Abilities: public_channel
      • Application needs to have access to the SGIDs that SIPL depends on as mentioned in the NVIDIA DRIVE OS Safety Developer Guide
    • API group
      • Init: Yes
      • Runtime: Yes
      • De-Init: Yes

    ◆ DevBlkCDII2CPgmrWriteUint8()

    NvMediaStatus DevBlkCDII2CPgmrWriteUint8 ( DevBlkCDII2CPgmr  i2cProgrammer,
    const uint16_t  address,
    const uint8_t  data 
    )

    Writes 8-bit data to an I2C register.

    This API does the following:

    1. Verifies all the input parameters.
    2. Calls CDAC to write an 8-bit data to an I2C register.
    Parameters
    [in]i2cProgrammerAn opaque handle for I2C Programmer; Valid value: [non-NULL].
    [in]address16-bit register address; Valid range: [0, UINT16_MAX].
    [in]data8-bit register data; Valid range: [0, UINT8_MAX]
    Return values
    NVMEDIA_STATUS_OKIf write to register is successful.
    NVMEDIA_STATUS_BAD_PARAMETERIf one or more params was NULL or invalid.
    NVMEDIA_STATUS_ERRORIf the devctl IPC call to CDAC device node failed.


    Usage considerations

    • Allowed context for the API call
      • Interrupt handler: No
      • Signal handler: No
      • Thread-safe: No
      • Re-entrant: No
      • Async/Sync: Sync
    • Required privileges: Yes, with the following conditions:
      • Grants: nonroot, allow
      • Abilities: public_channel
      • Application needs to have access to the SGIDs that SIPL depends on as mentioned in the NVIDIA DRIVE OS Safety Developer Guide
    • API group
      • Init: Yes
      • Runtime: Yes
      • De-Init: Yes
    人人超碰97caoporen国产