Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- First of all, you must include the header file ieibt878.h in your application.
- 1. To use auto-detect function (detect signal removal automatically), use structure iei_auto_detect and VIDIOC_IEI_SET_AUTO_DETECT ioctl call. The rules are shown as below:
- To enable auto-detect function, assign auto_detect to 1
- To disable auto-detect function, assign auto_detect to 0
- To get auto-detect function statue, use structure iei_auto_detect and VIDIOC_IEI_GET_AUTO_DETECT ioctl call.
- 2. To use auto-switch function (switch between channels automatically), use structure iei_auto_switch and VIDIOC_IEI_SET_AUTO_SWITCH ioctl call. The rules are shown as below:
- To enable auto-switch function, assign auto_switch to 1
- To disable auto-switch function, assign auto_switch to 0
- To get auto-switch function statue, use structure iei_auto_switch and VIDIOC_IEI_GET_AUTO_SWITCH ioctl call.
- 3. To set channels, use structure iei_channel_mask and VIDIOC_IEI_SET_CHANNEL_MASK ioctl call. The rules are shown as below:
- To enable/disable channel 1, assign bit 0 of ch_mask to 1/0
- To enable/disable channel 2, assign bit 1 of ch_mask to 1/0
- To enable/disable channel 3, assign bit 2 of ch_mask to 1/0
- To enable/disable channel 4, assign bit 3 of ch_mask to 1/0
- For example, if you want to enable channel 1 and 3 disable channel 2 and 4, you should assign ch_mask to 0x5.
- To get channel status, use structure iei_channel_mask and VIDIOC_IEI_GET_CHANNEL_MASK ioctl call.
- 4. To set GPIO outputs, use structure iei_gpio and VIDIOC_IEI_SET_GPIO ioctl call. The rules are shown as below:
- To set the output 1, assign bit 0 of gpio_target to 1 and bit 0 of gpio_value to 0 or 1
- To set the output 2, assign bit 1 of gpio_target to 1 and bit 1 of gpio_value to 0 or 1
- To set the output 3, assign bit 2 of gpio_target to 1 and bit 2 of gpio_value to 0 or 1
- To set the output 4, assign bit 3 of gpio_target to 1 and bit 3 of gpio_value to 0 or 1
- For example, if you want to set the output 1 and 3 to 0 and set the output 2 and 4 to 1, you should assign gpio_target to 0xf and gpio_value to 0xa.
- To get GPIO inputs and outputs, use structure iei_gpio and VIDIOC_IEI_GET_GPIO ioctl call. The meaning of the returned value is shown as below:
- gpio_target - don't care
- gpio_value - bit 0 = input1, bit 1 = input 2, bit 2 = input 3, bit 3 = input 4, bit 4 = output 1, bit 5 = output 2, bit 6 = input 1, bit 7 = output 4
Add Comment
Please, Sign In to add comment