All Files Functions Typedefs Enumerations Enumerator Macros Pages
Typedefs | Functions
BconAdapterI2C.h File Reference

Defines the I2C interface of the BCON adapter. More...

#include "BconAdapterDefines.h"
#include "BconAdapterTypes.h"
#include <stddef.h>

Typedefs

typedef struct
BconAdapterI2cBusHandle_tag * 
BconAdapterI2cBusHandle
 Handle representing an I2C bus instance. A handle value of null is considered invalid.
 

Functions

BCONSTATUS BCON_ADAPTER_CALL BconAdapterI2cOpenConnection (const char deviceId[], BconAdapterI2cBusHandle *phBus, uint32_t *pDeviceAddress)
 Opens the I2C bus connection to a camera device. This call can be used to initialize I2C bus hardware or allocate resources needed. More...
 
BCONSTATUS BCON_ADAPTER_CALL BconAdapterI2cCloseConnection (BconAdapterI2cBusHandle hBus, uint32_t deviceAddress)
 Closes the I2C bus connection to a camera device. Memory and resources allocated during BconAdapterI2cOpenConnection() can be freed. More...
 
BCONSTATUS BCON_ADAPTER_CALL BconAdapterI2cRead (BconAdapterI2cBusHandle hBus, uint32_t deviceAddress, void *pData, size_t sizeInBytes, size_t *pBytesRead, uint32_t timeout_ms)
 Reads a block of data from I2C bus. More...
 
BCONSTATUS BCON_ADAPTER_CALL BconAdapterI2cWrite (BconAdapterI2cBusHandle hBus, uint32_t deviceAddress, const void *pData, size_t sizeInBytes, uint32_t timeout_ms)
 Writes a block of data on the I2C bus. More...
 

Detailed Description

Defines the I2C interface of the BCON adapter.

Function Documentation

BCONSTATUS BCON_ADAPTER_CALL BconAdapterI2cCloseConnection ( BconAdapterI2cBusHandle  hBus,
uint32_t  deviceAddress 
)

Closes the I2C bus connection to a camera device. Memory and resources allocated during BconAdapterI2cOpenConnection() can be freed.

Parameters
[in]hBusBus handle.
[in]deviceAddressThe device address (I2C) of the device.
Returns
The status of the operation.
Return values
BCON_OKon success.
BCON_E_NOT_FOUNDif device is not open.
Anyother BCON adapter error code otherwise.
Precondition
I2C bus is in connected state and the device is open.
Postcondition
The device is closed.
Thread Safety:
This function must be thread-safe. Only one thread accesses the I2C functions at the same time per device address.
Note
This function must be implemented.
BCONSTATUS BCON_ADAPTER_CALL BconAdapterI2cOpenConnection ( const char  deviceId[],
BconAdapterI2cBusHandle phBus,
uint32_t *  pDeviceAddress 
)

Opens the I2C bus connection to a camera device. This call can be used to initialize I2C bus hardware or allocate resources needed.

Note
The device address of the camera is also returned. This information is handed down to the read and write functions.
Parameters
[in]deviceIdDevice identifier received during discovery.
[out]phBusI2C bus handle created. If multiple cameras share an I2C bus, the returned handles must be equal.
[out]pDeviceAddressThe device address (I2C) of the device. It will be used in BconAdapterI2cRead and BconAdapterI2cWrite operations.
Returns
The status of the operation.
Return values
BCON_OKon success.
BCON_E_NOT_FOUNDif device is not available.
Anyother BCON adapter error code otherwise.
Postcondition
I2C bus is in use and the device is open.
Thread Safety:
This function must be thread-safe. It is assumed that a known fixed amount of cameras is attached to a BCON system, so that required data structures can be allocated when BconAdapterInit() is called. Therefore, thread-safety can be assured without using additional locking.
Note
This function must be implemented.
BCONSTATUS BCON_ADAPTER_CALL BconAdapterI2cRead ( BconAdapterI2cBusHandle  hBus,
uint32_t  deviceAddress,
void *  pData,
size_t  sizeInBytes,
size_t *  pBytesRead,
uint32_t  timeout_ms 
)

Reads a block of data from I2C bus.

Parameters
[in]hBusBus handle.
[in]deviceAddressDevice address space (I2C).
[out]pDataPointer to the data buffer.
[in]sizeInBytesSize of the data buffer.
[out]pBytesReadNumber of bytes read.
[in]timeout_msTimeout in milliseconds.
Returns
The status of the operation.
Return values
BCON_OKon success.
BCON_E_TIMEOUTif the operation timed out.
Anyother BCON adapter error code otherwise.
Precondition
The connection with this device has been started.
Thread Safety:
This function must be thread-safe. Only one thread accesses the I2C functions at the same time per device address.
Note
This function must be implemented.
BCONSTATUS BCON_ADAPTER_CALL BconAdapterI2cWrite ( BconAdapterI2cBusHandle  hBus,
uint32_t  deviceAddress,
const void *  pData,
size_t  sizeInBytes,
uint32_t  timeout_ms 
)

Writes a block of data on the I2C bus.

Parameters
[in]hBusBus handle.
[in]deviceAddressDevice address space (I2C).
[in]pDataPointer to the data buffer.
[in]sizeInBytesSize of data buffer in bytes.
[in]timeout_msTimeout in milliseconds.
Returns
The status of the operation.
Return values
BCON_OKon success
BCON_E_TIMEOUTif the operation timed out.
Anyother BCON adapter error code otherwise.
Thread Safety:
This function must be thread-safe. Only one thread accesses the I2C functions at the same time per device address.
Note
This function must be implemented.

BCONAdapterAPI 3.0
© 2016-2017 Basler AG (Tue May 30 2017 17:24:55)