0001
0002
0003
0004
0005
0006 #ifndef __PVRUSB2_HDW_H
0007 #define __PVRUSB2_HDW_H
0008
0009 #include <linux/usb.h>
0010 #include <linux/videodev2.h>
0011 #include <media/v4l2-dev.h>
0012 #include "pvrusb2-io.h"
0013 #include "pvrusb2-ctrl.h"
0014
0015
0016
0017
0018 #define PVR2_CID_STDCUR 2
0019 #define PVR2_CID_STDAVAIL 3
0020 #define PVR2_CID_INPUT 4
0021 #define PVR2_CID_AUDIOMODE 5
0022 #define PVR2_CID_FREQUENCY 6
0023 #define PVR2_CID_HRES 7
0024 #define PVR2_CID_VRES 8
0025 #define PVR2_CID_CROPL 9
0026 #define PVR2_CID_CROPT 10
0027 #define PVR2_CID_CROPW 11
0028 #define PVR2_CID_CROPH 12
0029 #define PVR2_CID_CROPCAPPAN 13
0030 #define PVR2_CID_CROPCAPPAD 14
0031 #define PVR2_CID_CROPCAPBL 15
0032 #define PVR2_CID_CROPCAPBT 16
0033 #define PVR2_CID_CROPCAPBW 17
0034 #define PVR2_CID_CROPCAPBH 18
0035 #define PVR2_CID_STDDETECT 19
0036
0037
0038 #define PVR2_CVAL_INPUT_TV 0
0039 #define PVR2_CVAL_INPUT_DTV 1
0040 #define PVR2_CVAL_INPUT_COMPOSITE 2
0041 #define PVR2_CVAL_INPUT_SVIDEO 3
0042 #define PVR2_CVAL_INPUT_RADIO 4
0043 #define PVR2_CVAL_INPUT_MAX PVR2_CVAL_INPUT_RADIO
0044
0045 enum pvr2_config {
0046 pvr2_config_empty,
0047 pvr2_config_mpeg,
0048 pvr2_config_vbi,
0049 pvr2_config_pcm,
0050 pvr2_config_rawvideo,
0051 };
0052
0053 enum pvr2_v4l_type {
0054 pvr2_v4l_type_video,
0055 pvr2_v4l_type_vbi,
0056 pvr2_v4l_type_radio,
0057 };
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080 #define PVR2_STATE_NONE 0
0081 #define PVR2_STATE_DEAD 1
0082 #define PVR2_STATE_COLD 2
0083 #define PVR2_STATE_WARM 3
0084 #define PVR2_STATE_ERROR 4
0085 #define PVR2_STATE_READY 5
0086 #define PVR2_STATE_RUN 6
0087
0088
0089 const char *pvr2_config_get_name(enum pvr2_config);
0090
0091 struct pvr2_hdw;
0092
0093
0094
0095 struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
0096 const struct usb_device_id *devid);
0097
0098
0099
0100 int pvr2_hdw_initialize(struct pvr2_hdw *,
0101 void (*callback_func)(void *),
0102 void *callback_data);
0103
0104
0105 void pvr2_hdw_destroy(struct pvr2_hdw *);
0106
0107
0108 int pvr2_hdw_dev_ok(struct pvr2_hdw *);
0109
0110
0111
0112 int pvr2_hdw_get_unit_number(struct pvr2_hdw *);
0113
0114
0115 struct usb_device *pvr2_hdw_get_dev(struct pvr2_hdw *);
0116
0117
0118 unsigned long pvr2_hdw_get_sn(struct pvr2_hdw *);
0119
0120
0121 const char *pvr2_hdw_get_bus_info(struct pvr2_hdw *);
0122
0123
0124 const char *pvr2_hdw_get_device_identifier(struct pvr2_hdw *);
0125
0126
0127 void pvr2_hdw_disconnect(struct pvr2_hdw *);
0128
0129
0130 void pvr2_hdw_set_v4l2_dev(struct pvr2_hdw *, struct video_device *);
0131
0132
0133 unsigned int pvr2_hdw_get_ctrl_count(struct pvr2_hdw *);
0134
0135
0136 struct pvr2_ctrl *pvr2_hdw_get_ctrl_by_index(struct pvr2_hdw *,unsigned int);
0137
0138
0139 struct pvr2_ctrl *pvr2_hdw_get_ctrl_by_id(struct pvr2_hdw *,unsigned int);
0140
0141
0142 struct pvr2_ctrl *pvr2_hdw_get_ctrl_v4l(struct pvr2_hdw *,unsigned int ctl_id);
0143
0144
0145 struct pvr2_ctrl *pvr2_hdw_get_ctrl_nextv4l(struct pvr2_hdw *,
0146 unsigned int ctl_id);
0147
0148
0149 int pvr2_hdw_commit_ctl(struct pvr2_hdw *);
0150
0151
0152
0153 unsigned int pvr2_hdw_get_input_available(struct pvr2_hdw *);
0154
0155
0156
0157 unsigned int pvr2_hdw_get_input_allowed(struct pvr2_hdw *);
0158
0159
0160
0161
0162
0163
0164 int pvr2_hdw_set_input_allowed(struct pvr2_hdw *,
0165 unsigned int change_mask,
0166 unsigned int change_val);
0167
0168
0169 const char *pvr2_hdw_get_driver_name(struct pvr2_hdw *);
0170
0171
0172 void pvr2_hdw_execute_tuner_poll(struct pvr2_hdw *);
0173
0174
0175 int pvr2_hdw_get_tuner_status(struct pvr2_hdw *,struct v4l2_tuner *);
0176
0177
0178 int pvr2_hdw_get_cropcap(struct pvr2_hdw *, struct v4l2_cropcap *);
0179
0180
0181 int pvr2_hdw_is_hsm(struct pvr2_hdw *);
0182
0183
0184 const char *pvr2_hdw_get_type(struct pvr2_hdw *);
0185
0186
0187 const char *pvr2_hdw_get_desc(struct pvr2_hdw *);
0188
0189
0190 int pvr2_hdw_set_streaming(struct pvr2_hdw *,int);
0191
0192
0193 int pvr2_hdw_get_streaming(struct pvr2_hdw *);
0194
0195
0196 int pvr2_hdw_get_state(struct pvr2_hdw *);
0197
0198
0199 int pvr2_hdw_set_stream_type(struct pvr2_hdw *, enum pvr2_config);
0200
0201
0202 struct pvr2_stream *pvr2_hdw_get_video_stream(struct pvr2_hdw *);
0203
0204
0205
0206
0207
0208 void pvr2_hdw_cpufw_set_enabled(struct pvr2_hdw *,
0209 int mode,
0210 int enable_flag);
0211
0212
0213 int pvr2_hdw_cpufw_get_enabled(struct pvr2_hdw *);
0214
0215
0216
0217
0218 int pvr2_hdw_cpufw_get(struct pvr2_hdw *,unsigned int offs,
0219 char *buf,unsigned int cnt);
0220
0221
0222 int pvr2_hdw_v4l_get_minor_number(struct pvr2_hdw *,enum pvr2_v4l_type index);
0223
0224
0225 void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *,
0226 enum pvr2_v4l_type index,int);
0227
0228
0229
0230
0231
0232
0233 int pvr2_send_request(struct pvr2_hdw *,
0234 void *write_ptr,unsigned int write_len,
0235 void *read_ptr,unsigned int read_len);
0236
0237
0238 int pvr2_write_register(struct pvr2_hdw *, u16, u32);
0239
0240
0241
0242 void pvr2_hdw_render_useless(struct pvr2_hdw *);
0243
0244
0245 void pvr2_hdw_cpureset_assert(struct pvr2_hdw *,int);
0246
0247
0248 void pvr2_hdw_device_reset(struct pvr2_hdw *);
0249
0250
0251 int pvr2_hdw_untrip(struct pvr2_hdw *);
0252
0253
0254
0255
0256 int pvr2_hdw_cmd_deep_reset(struct pvr2_hdw *);
0257
0258
0259 int pvr2_hdw_cmd_powerup(struct pvr2_hdw *);
0260
0261
0262 int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *);
0263
0264
0265 int pvr2_hdw_gpio_get_dir(struct pvr2_hdw *hdw,u32 *);
0266 int pvr2_hdw_gpio_get_out(struct pvr2_hdw *hdw,u32 *);
0267 int pvr2_hdw_gpio_get_in(struct pvr2_hdw *hdw,u32 *);
0268 int pvr2_hdw_gpio_chg_dir(struct pvr2_hdw *hdw,u32 msk,u32 val);
0269 int pvr2_hdw_gpio_chg_out(struct pvr2_hdw *hdw,u32 msk,u32 val);
0270
0271
0272 struct pvr2_hdw_debug_info {
0273 int big_lock_held;
0274 int ctl_lock_held;
0275 int flag_disconnected;
0276 int flag_init_ok;
0277 int flag_ok;
0278 int fw1_state;
0279 int flag_decoder_missed;
0280 int flag_tripped;
0281 int state_encoder_ok;
0282 int state_encoder_run;
0283 int state_decoder_run;
0284 int state_decoder_ready;
0285 int state_usbstream_run;
0286 int state_decoder_quiescent;
0287 int state_pipeline_config;
0288 int state_pipeline_req;
0289 int state_pipeline_pause;
0290 int state_pipeline_idle;
0291 int cmd_debug_state;
0292 int cmd_debug_write_len;
0293 int cmd_debug_read_len;
0294 int cmd_debug_write_pend;
0295 int cmd_debug_read_pend;
0296 int cmd_debug_timeout;
0297 int cmd_debug_rstatus;
0298 int cmd_debug_wstatus;
0299 unsigned char cmd_code;
0300 };
0301
0302
0303
0304
0305
0306 void pvr2_hdw_get_debug_info_unlocked(const struct pvr2_hdw *hdw,
0307 struct pvr2_hdw_debug_info *);
0308
0309
0310
0311
0312
0313 void pvr2_hdw_get_debug_info_locked(struct pvr2_hdw *hdw,
0314 struct pvr2_hdw_debug_info *);
0315
0316
0317
0318 unsigned int pvr2_hdw_state_report(struct pvr2_hdw *hdw,
0319 char *buf_ptr,unsigned int buf_size);
0320
0321
0322 void pvr2_hdw_trigger_module_log(struct pvr2_hdw *hdw);
0323
0324
0325
0326
0327 int pvr2_upload_firmware2(struct pvr2_hdw *hdw);
0328
0329 #endif