Basic Device
The following code block shows the data structure for the basic device structure.
typedef struct _ST_CI_DEVICE {
CI_CONNECTION *pstCiConnection;
STF_U8 u8DeviceId;
STF_U8 u8DeviceType;
STF_CHAR szDeviceName[DEV_NAME_LEN_MAX];
STF_S32 s32CiConnections;
STF_BOOL8 bConnected;
EN_MEM_TYPE enMemType;
STF_VOID *pvDevParam;
STF_RESULT (*Destroy)(ST_CI_DEVICE *pstDevice);
STF_RESULT (*Connection)(ST_CI_DEVICE *pstDevice);
STF_RESULT (*Disconnect)(ST_CI_DEVICE *pstDevice);
STF_BOOL8 (*IsConnected)(ST_CI_DEVICE *pstDevice);
STF_S32 (*GetConnections)(ST_CI_DEVICE *pstDevice);
CI_CONNECTION *(*GetConnection)(ST_CI_DEVICE *pstDevice);
int (*GetFileHandle)(ST_CI_DEVICE *pstDevice);
STF_RESULT (*SubscribeEvent)(ST_CI_DEVICE *pstDevice, STF_S32 s32EventType);
STF_RESULT (*UnsubscribeEvent)(ST_CI_DEVICE *pstDevice, STF_S32 s32EventType);
STF_RESULT (*DequeueEvent)(ST_CI_DEVICE *pstDevice, struct v4l2_event *pstEvent);
STF_RESULT (*InitDevice)(ST_CI_DEVICE *pstDevice, STF_U32 u32PixelFormat);
STF_U32 (*GetPixelFormat)(ST_CI_DEVICE *pstDevice);
STF_RESULT (*SetPixelFormat)(ST_CI_DEVICE *pstDevice, STF_U32 u32PixelFormat);
struct v4l2_rect (*QueryCropWin)(ST_CI_DEVICE *pstDevice);
ST_RECT (*QueryCropWin_2)(ST_CI_DEVICE *pstDevice);
struct v4l2_rect (*GetCropWin)(ST_CI_DEVICE *pstDevice);
ST_RECT (*GetCropWin_2)(ST_CI_DEVICE *pstDevice);
STF_RESULT (*SetCropWin)(ST_CI_DEVICE *pstDevice, struct v4l2_rect *pstRect);
STF_RESULT (*SetCropWin_2)(ST_CI_DEVICE *pstDevice, ST_RECT *pstRect);
STF_RESULT (*EnumFormat)(ST_CI_DEVICE *pstDevice);
STF_RESULT (*GetFormat)(ST_CI_DEVICE *pstDevice, struct v4l2_format *pstFormat);
STF_RESULT (*SetFormat)(ST_CI_DEVICE *pstDevice, STF_U16 u16Width, STF_U16 u16Height, STF_U32 u32PixelFormat);
STF_RESULT (*TryFormat)(ST_CI_DEVICE *pstDevice, STF_U32 u32PixelFormat);
STF_RESULT (*GetParam)(ST_CI_DEVICE *pstDevice, STF_U32 *pu32Numerator, STF_U32 *pu32Denominator);
STF_RESULT (*SetParam)(ST_CI_DEVICE *pstDevice, STF_U32 u32Numerator, STF_U32 u32Denominator);
STF_RESULT (*SetParam_2)(ST_CI_DEVICE *pstDevice, STF_U32 u32FPS);
struct v4l2_rect (*GetSelection)(ST_CI_DEVICE *pstDevice);
ST_RECT (*GetSelection_2)(ST_CI_DEVICE *pstDevice);
STF_RESULT (*SetSelection)(ST_CI_DEVICE *pstDevice, struct v4l2_rect *pstRect);
STF_RESULT (*SetSelection_2)(ST_CI_DEVICE *pstDevice, ST_RECT *pstRect);
STF_RESULT (*SetStreamOn)(ST_CI_DEVICE *pstDevice, STF_BOOL8 bOn);
STF_BOOL8 (*IsStreamOn)(ST_CI_DEVICE *pstDevice);
STF_RESULT (*AllocateBuf)(ST_CI_DEVICE *pstDevice, STF_U32 u32Count, STF_BOOL8 bMmap, STF_BOOL8 bExport, ST_DMA_BUF_INFO *pstDmaBufInfo);
STF_RESULT (*AllocateAndEnqueueBuf)(ST_CI_DEVICE *pstDevice, STF_U32 u32AllocateCount, STF_U32 u32EnqueueCount, STF_BOOL8 bMmap, STF_BOOL8 bExport, ST_DMA_BUF_INFO *pstDmaBufInfo);
ST_VDO_MEM *(*GetBuffer)(ST_CI_DEVICE *pstDevice, STF_U32 u32Index);
ST_VDO_BUF (*GetBufInfo)(ST_CI_DEVICE *pstDevice, STF_U32 u32Index);
STF_RESULT (*EnqueueBuf)(ST_CI_DEVICE *pstDevice, STF_U8 u8BufIdx);
STF_RESULT (*EnqueueBuf_2)(ST_CI_DEVICE *pstDevice, STF_U32 u32Count, ST_VDO_BUF_INFO *pstVideoBufferInfo);
STF_RESULT (*EnqueueBufFromAvailableQueue)(ST_CI_DEVICE *pstDevice, STF_S32 s32Count);
STF_RESULT (*EnqueueBufFromCompletedQueue)(ST_CI_DEVICE *pstDevice, STF_S32 s32Count);
STF_RESULT (*DequeueBuf)(ST_CI_DEVICE *pstDevice, ST_VDO_MEM **ppstVdoMem);
STF_RESULT (*DequeueBuf_2)(ST_CI_DEVICE *pstDevice, STF_S32 *ps32Count, ST_VDO_BUF_INFO *pstVideoBufferInfo);
STF_RESULT (*DequeueBufToCompletedQueue)(ST_CI_DEVICE *pstDevice, STF_S32 s32Count);
STF_RESULT (*SwitchBufFromCompletedToAvailableQueue)(ST_CI_DEVICE *pstDevice, STF_S32 s32RemainCount);
STF_RESULT (*PushBufToQueue)(ST_CI_DEVICE *pstDevice, sLinkedList_T *pstListQueue, ST_VDO_MEM *pstVdoMem, STF_BOOL8 bIsPushToFront);
ST_VDO_MEM *(*PopBufFromQueue)(ST_CI_DEVICE *pstDevice, sLinkedList_T *pstListQueue, STF_BOOL8 bIsPopFromBack);
STF_RESULT (*ReleaseBuf)(ST_CI_DEVICE *pstDevice);
STF_RESULT (*GenerateLinksInfo)(ST_CI_DEVICE *pstDevice, EN_SNSR_IF enSensorInterface, ST_ITEM_INFO *pstLinksInfo);
STF_RESULT (*ProcessLinks)(ST_CI_DEVICE *pstDevice, ST_ITEM_INFO *pstLinksInfo);
STF_RESULT (*ProcessLinks_2)(ST_CI_DEVICE *pstDevice, EN_SNSR_IF enSensorInterface);
} ST_CI_DEVICE, *PST_CI_DEVICE;
The following table describes the fields in the above code block.
| Field | Description |
|---|---|
| pstCiConnection | The connection handle |
| u8DeviceId | The device ID |
| u8DeviceType | The device type (FB, PP, DRM, Video, V4L2 sub-device, etc.) |
| szDeviceName | The device name |
| s32CiConnections | Indicate the number of applications using this connection handle |
| bConnected | Indicate whether the connection handle is open |
| enMemType | Indicate which video buffer type (EN_MEM_TYPE_MMAP or EN_MEM_TYPE_DMA) will be allocated |
| pvDevParam | Point to the device parameters structure |
| *Destroy | Destroy this device |
| *Connection | Connect to the device driver |
| *Disconnect | Disconnect form the device driver |
| *IsConnected | Check the connection status |
| *GetConnections | Get the number of connections |
| *GetConnection | Get the connection handle |
| *GetFileHandle | Get the file descriptor from the connection handle |
| *SubscribeEvent1 | Subscribe an event to the video device |
| *UnsubscribeEvent1 | Unsubscribe an event to the video device |
| *DequeueEvent1 | Dequeue an event from the video device |
| *InitDevice | Device initialization |
| *GetPixelFormat | Get the pixel format from the device |
| *SetPixelFormat | Set the pixel format to the device |
| *QueryCropWin1 | Query the cropping window from the video device |
| *QueryCropWin_21 | Query the cropping window from the video device |
| *GetCropWin1 | Get the cropping window from the video device |
| *GetCropWin_21 | Get the cropping window from the video device |
| *SetCropWin1 | Set the cropping window into the video device |
| *SetCropWin_21 | Set the cropping window into the video device |
| *EnumFormat1 | Enumerate supported formats from the video device |
| *GetFormat1 | Get the data format from the video device |
| *SetFormat1 | Set the data format into the video device |
| *TryFormat1 | Test if the video device supports this data format |
| *GetParam1 | Get streaming parameters from the video device |
| *SetParam1 | Set streaming parameters into the video device |
| *SetParam_21 | Set streaming parameters into the video device |
| *GetSelection1 | Get selection rectangle from the video device |
| *GetSelection_21 | Get selection rectangle from the video device |
| *SetSelection1 | Set selection rectangle into the video device |
| *SetSelection_21 | Set selection rectangle into the video device |
| *SetStreamOn1 | Start/Stop video device streaming I/O |
| *IsStreamOn1 | Check the streaming I/O status from the video device |
| *AllocateBuf2 | Allocate buffers for the device |
| *AllocateAndEnqueueBuf1 | Allocate and enqueue buffers into the video device |
| *GetBuffer1 | Get the video buffer from the video device |
| *GetBufInfo1 | Get the video buffer information from the video device |
| *EnqueueBuf1 | Enqueue buffer into the video device |
| *EnqueueBuf_21 | Enqueue buffers into the video device |
| *EnqueueBufFromAvailableQueue1 | Enqueue buffers from available queue to the video device |
| *EnqueueBufFromCompletedQueue1 | Enqueue buffers from completed queue to the video device |
| *DequeueBuf1 | Dequeue buffers from the video device |
| *DequeueBuf_21 | Dequeue buffers from the video device |
| *DequeueBufToCompletedQueue1 | Dequeue buffers from the video device to completed queue |
| *SwitchBufFromCompletedToAvailableQueue1 | Switch buffers from the completed queue to available queue |
| *PushBufToQueue1 | Push buffer into the queue |
| *PopBufFromQueue1 | Pop buffer from the queue |
| *ReleaseBuf2 | Release buffers from the device |
| *GenerateLinksInfo1 | Generate the media link information |
| *ProcessLinks1 | Process the media link settings |
| *ProcessLinks_21 | Process the media link settings |
Note:
-
The field items are for video device only.
-
The field items are for DRM and video device only.
