Guest User

Untitled

a guest
Jan 19th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. First of all, you must include the header file ieibt878.h in your application.
  2.  
  3. 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:
  4.  
  5. To enable auto-detect function, assign auto_detect to 1
  6. To disable auto-detect function, assign auto_detect to 0
  7.  
  8. To get auto-detect function statue, use structure iei_auto_detect and VIDIOC_IEI_GET_AUTO_DETECT ioctl call.
  9.  
  10. 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:
  11.  
  12. To enable auto-switch function, assign auto_switch to 1
  13. To disable auto-switch function, assign auto_switch to 0
  14.  
  15. To get auto-switch function statue, use structure iei_auto_switch and VIDIOC_IEI_GET_AUTO_SWITCH ioctl call.
  16.  
  17. 3. To set channels, use structure iei_channel_mask and VIDIOC_IEI_SET_CHANNEL_MASK ioctl call. The rules are shown as below:
  18.  
  19. To enable/disable channel 1, assign bit 0 of ch_mask to 1/0
  20. To enable/disable channel 2, assign bit 1 of ch_mask to 1/0
  21. To enable/disable channel 3, assign bit 2 of ch_mask to 1/0
  22. To enable/disable channel 4, assign bit 3 of ch_mask to 1/0
  23.  
  24. For example, if you want to enable channel 1 and 3 disable channel 2 and 4, you should assign ch_mask to 0x5.
  25.  
  26. To get channel status, use structure iei_channel_mask and VIDIOC_IEI_GET_CHANNEL_MASK ioctl call.
  27.  
  28. 4. To set GPIO outputs, use structure iei_gpio and VIDIOC_IEI_SET_GPIO ioctl call. The rules are shown as below:
  29.  
  30. To set the output 1, assign bit 0 of gpio_target to 1 and bit 0 of gpio_value to 0 or 1
  31. To set the output 2, assign bit 1 of gpio_target to 1 and bit 1 of gpio_value to 0 or 1
  32. To set the output 3, assign bit 2 of gpio_target to 1 and bit 2 of gpio_value to 0 or 1
  33. To set the output 4, assign bit 3 of gpio_target to 1 and bit 3 of gpio_value to 0 or 1
  34.  
  35. 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.
  36.  
  37. 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:
  38.  
  39. gpio_target - don't care
  40. 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