quickcam_messenger.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #ifndef quickcam_messenger_h
  2. #define quickcam_messenger_h
  3. #ifndef CONFIG_INPUT
  4. /* if we're not using input we dummy out these functions */
  5. #define qcm_register_input(...)
  6. #define qcm_unregister_input(...)
  7. #define qcm_report_buttonstat(...)
  8. #define qcm_setup_input_int(...) 0
  9. #define qcm_stop_int_data(...)
  10. #define qcm_alloc_int_urb(...) 0
  11. #define qcm_free_int(...)
  12. #endif
  13. #define CHECK_RET(ret, expr) \
  14. if ((ret = expr) < 0) return ret
  15. /* Control Registers for the STVV6422 ASIC
  16. * - this define is taken from the qc-usb-messenger code
  17. */
  18. #define STV_ISO_ENABLE 0x1440
  19. #define ISOC_PACKET_SIZE 1023
  20. /* Chip identification number including revision indicator */
  21. #define CMOS_SENSOR_IDREV 0xE00A
  22. struct rgb {
  23. u8 b;
  24. u8 g;
  25. u8 r;
  26. u8 b2;
  27. u8 g2;
  28. u8 r2;
  29. };
  30. struct bayL0 {
  31. #ifdef __BIG_ENDIAN
  32. u8 r;
  33. u8 g;
  34. #elif __LITTLE_ENDIAN
  35. u8 g;
  36. u8 r;
  37. #else
  38. #error not byte order defined
  39. #endif
  40. };
  41. struct bayL1 {
  42. #ifdef __BIG_ENDIAN
  43. u8 g;
  44. u8 b;
  45. #elif __LITTLE_ENDIAN
  46. u8 b;
  47. u8 g;
  48. #else
  49. #error not byte order defined
  50. #endif
  51. };
  52. struct cam_size {
  53. u16 width;
  54. u16 height;
  55. u8 cmd;
  56. };
  57. static const struct cam_size camera_sizes[] = {
  58. { 160, 120, 0xf },
  59. { 320, 240, 0x2 },
  60. };
  61. enum frame_sizes {
  62. SIZE_160X120 = 0,
  63. SIZE_320X240 = 1,
  64. };
  65. #define MAX_FRAME_SIZE SIZE_320X240
  66. struct qcm {
  67. u16 colour;
  68. u16 hue;
  69. u16 brightness;
  70. u16 contrast;
  71. u16 whiteness;
  72. u8 size;
  73. int height;
  74. int width;
  75. u8 *scratch;
  76. struct urb *button_urb;
  77. u8 button_sts;
  78. u8 button_sts_buf;
  79. #ifdef CONFIG_INPUT
  80. struct input_dev *input;
  81. char input_physname[64];
  82. #endif
  83. };
  84. struct regval {
  85. u16 reg;
  86. u8 val;
  87. };
  88. /* this table is derived from the
  89. qc-usb-messenger code */
  90. static const struct regval regval_table[] = {
  91. { STV_ISO_ENABLE, 0x00 },
  92. { 0x1436, 0x00 }, { 0x1432, 0x03 },
  93. { 0x143a, 0xF9 }, { 0x0509, 0x38 },
  94. { 0x050a, 0x38 }, { 0x050b, 0x38 },
  95. { 0x050c, 0x2A }, { 0x050d, 0x01 },
  96. { 0x1431, 0x00 }, { 0x1433, 0x34 },
  97. { 0x1438, 0x18 }, { 0x1439, 0x00 },
  98. { 0x143b, 0x05 }, { 0x143c, 0x00 },
  99. { 0x143e, 0x01 }, { 0x143d, 0x00 },
  100. { 0x1442, 0xe2 }, { 0x1500, 0xd0 },
  101. { 0x1500, 0xd0 }, { 0x1500, 0x50 },
  102. { 0x1501, 0xaf }, { 0x1502, 0xc2 },
  103. { 0x1503, 0x45 }, { 0x1505, 0x02 },
  104. { 0x150e, 0x8e }, { 0x150f, 0x37 },
  105. { 0x15c0, 0x00 },
  106. };
  107. static const unsigned char marker[] = { 0x00, 0xff, 0x00, 0xFF };
  108. #endif /* quickcam_messenger_h */