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