diff options
author | Mike Isely <isely@pobox.com> | 2006-04-19 23:56:17 -0500 |
---|---|---|
committer | Mike Isely <isely@pobox.com> | 2006-04-19 23:56:17 -0500 |
commit | bbfdc6d1fdaea36ca996bb4cfdcc493d998a65f6 (patch) | |
tree | 9a781db7c357c0ce566a98a5c13f57a9f8be7fda /linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h | |
parent | a3f7122e105b35188a9e1bc89fdc15758fae8b15 (diff) | |
download | mediapointer-dvb-s2-bbfdc6d1fdaea36ca996bb4cfdcc493d998a65f6.tar.gz mediapointer-dvb-s2-bbfdc6d1fdaea36ca996bb4cfdcc493d998a65f6.tar.bz2 |
Rework pvrusb2 internal controls implementation
From: Mike Isely <isely@pobox.com>
Rework controls internal architecture. Rework video standard
handling. This is a major change.
Signed-off-by: Mike Isely <isely@pobox.com>
Diffstat (limited to 'linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h')
-rw-r--r-- | linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h | 172 |
1 files changed, 100 insertions, 72 deletions
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h index 9c5f0f74c..ad48f0751 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h @@ -45,49 +45,9 @@ #include "pvrusb2-hdw.h" #include "pvrusb2-io.h" - -/* Definition of state variables that we can inspect & change. Numbers are - assigned from zero counting up with no gaps. */ -#define PVR2_CID_BRIGHTNESS 0 -#define PVR2_CID_CONTRAST 1 -#define PVR2_CID_SATURATION 2 -#define PVR2_CID_HUE 3 -#define PVR2_CID_VOLUME 4 -#define PVR2_CID_BALANCE 5 -#define PVR2_CID_BASS 6 -#define PVR2_CID_TREBLE 7 -#define PVR2_CID_MUTE 8 -#define PVR2_CID_SRATE 9 -#define PVR2_CID_AUDIOBITRATE 10 -#define PVR2_CID_AUDIOCRC 11 -#define PVR2_CID_AUDIOEMPHASIS 12 -#define PVR2_CID_VBR 13 -#define PVR2_CID_AVERAGEVIDEOBITRATE 14 -#define PVR2_CID_PEAKVIDEOBITRATE 15 -#define PVR2_CID_STDAVAIL 16 // V4L2 video standard bit mask -#define PVR2_CID_INPUT 17 -#define PVR2_CID_AUDIOMODE 18 // V4L2 standard audio mode enum -#define PVR2_CID_FREQUENCY 19 // Units of Hz -#define PVR2_CID_HRES 20 -#define PVR2_CID_VRES 21 -#define PVR2_CID_INTERLACE 22 -#define PVR2_CID_AUDIOLAYER 23 -#define PVR2_CID_CHANNEL 24 -#define PVR2_CID_CHANPROG_ID 25 -#define PVR2_CID_CHANPROG_FREQ 26 -#define PVR2_CID_SIGNAL_PRESENT 27 -#define PVR2_CID_STREAMING_ENABLED 28 -#define PVR2_CID_HSM 29 -#define PVR2_CID_SUBSYS_MASK 30 -#define PVR2_CID_SUBSYS_STREAM_MASK 31 -#define PVR2_CID_STDCUR 32 // V4L2 video standard bit mask -#define PVR2_CID_STDNAME 33 // Enumeration of available standards - /* Legal values for the SRATE state variable */ #define PVR2_CVAL_SRATE_48 0 #define PVR2_CVAL_SRATE_44_1 1 -#define PVR2_CVAL_SRATE_MIN PVR2_CVAL_SRATE_48 -#define PVR2_CVAL_SRATE_MAX PVR2_CVAL_SRATE_44_1 /* Legal values for the AUDIOBITRATE state variable */ #define PVR2_CVAL_AUDIOBITRATE_384 0 @@ -105,22 +65,16 @@ #define PVR2_CVAL_AUDIOBITRATE_48 12 #define PVR2_CVAL_AUDIOBITRATE_32 13 #define PVR2_CVAL_AUDIOBITRATE_VBR 14 -#define PVR2_CVAL_AUDIOBITRATE_MIN PVR2_CVAL_AUDIOBITRATE_384 -#define PVR2_CVAL_AUDIOBITRATE_MAX PVR2_CVAL_AUDIOBITRATE_VBR /* Legal values for the AUDIOEMPHASIS state variable */ #define PVR2_CVAL_AUDIOEMPHASIS_NONE 0 #define PVR2_CVAL_AUDIOEMPHASIS_50_15 1 #define PVR2_CVAL_AUDIOEMPHASIS_CCITT 2 -#define PVR2_CVAL_AUDIOEMPHASIS_MIN PVR2_CVAL_AUDIOEMPHASIS_NONE -#define PVR2_CVAL_AUDIOEMPHASIS_MAX PVR2_CVAL_AUDIOEMPHASIS_CCITT /* Legal values for PVR2_CID_HSM */ #define PVR2_CVAL_HSM_FAIL 0 #define PVR2_CVAL_HSM_FULL 1 #define PVR2_CVAL_HSM_HIGH 2 -#define PVR2_CVAL_HSM_MIN PVR2_CVAL_HSM_FAIL -#define PVR2_CVAL_HSM_MAX PVR2_CVAL_HSM_HIGH #define PVR2_VID_ENDPOINT 0x84 #define PVR2_UNK_ENDPOINT 0x86 /* maybe raw yuv ? */ @@ -135,37 +89,72 @@ struct pvr2_decoder; -struct pvr2_ctl_def; -struct pvr2_ctrl; - -typedef int (*pvr2_ctl_set_func)(struct pvr2_ctrl *,int val); -typedef int (*pvr2_ctl_get_func)(struct pvr2_ctrl *); - -struct pvr2_ctl_def { - int id; +typedef int (*pvr2_ctlf_is_dirty)(struct pvr2_ctrl *); +typedef void (*pvr2_ctlf_clear_dirty)(struct pvr2_ctrl *); +typedef int (*pvr2_ctlf_get_value)(struct pvr2_ctrl *,int *); +typedef int (*pvr2_ctlf_set_value)(struct pvr2_ctrl *,int msk,int val); +typedef int (*pvr2_ctlf_val_to_sym)(struct pvr2_ctrl *,int msk,int val, + char *,unsigned int,unsigned int *); +typedef int (*pvr2_ctlf_sym_to_val)(struct pvr2_ctrl *, + const char *,unsigned int, + int *mskp,int *valp); + +/* This structure describes a specific control. A table of these is set up + in pvrusb2-hdw.c. */ +struct pvr2_ctl_info { + /* Control's name suitable for use as an identifier */ const char *name; + + /* Short description of control */ const char *desc; - pvr2_ctl_set_func set_func; - pvr2_ctl_get_func get_func; - int mask_value; - int max_value; - int min_value; + + /* Control's implementation */ + pvr2_ctlf_get_value get_value; /* Get its value */ + pvr2_ctlf_set_value set_value; /* Set its value */ + pvr2_ctlf_val_to_sym val_to_sym; /* Custom convert value->symbol */ + pvr2_ctlf_sym_to_val sym_to_val; /* Custom convert symbol->value */ + pvr2_ctlf_is_dirty is_dirty; /* Return true if dirty */ + pvr2_ctlf_clear_dirty clear_dirty; /* Clear dirty state */ + + /* Control's type (int, enum, bitmask) */ + enum pvr2_ctl_type type; + + /* Associated V4L control ID, if any */ + int v4l_id; + + /* Associated driver internal ID, if any */ + int internal_id; + + /* Don't implicitly initialize this control's value */ int skip_init; - int default_value; - int is_valid; - const char **value_defs_ptr; - unsigned int value_defs_count; + + /* Starting value for this control */ + long default_value; + + /* Type-specific control information */ + union { + struct { /* Integer control */ + long min_value; /* lower limit */ + long max_value; /* upper limit */ + } type_int; + struct { /* enumerated control */ + unsigned int count; /* enum value count */ + const char **value_names; /* symbol names */ + } type_enum; + struct { /* bitmask control */ + unsigned int valid_bits; /* bits in use */ + const char **bit_names; /* symbol name/bit */ + } type_bitmask; + } def; }; struct pvr2_ctrl { + const struct pvr2_ctl_info *info; struct pvr2_hdw *hdw; - const struct pvr2_ctl_def *ctl_def; - int is_valid; - int value; - int dirty; }; + struct pvr2_audio_stat { void *ctxt; void (*detach)(void *); @@ -247,6 +236,10 @@ struct pvr2_hdw { /* Frequency table */ unsigned int freqTable[FREQTABLE_SIZE]; + unsigned int freqProgSlot; + unsigned int freqSlot; + unsigned int freqVal; + int freqDirty; /* Stuff for handling low level control interaction with device */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) @@ -298,9 +291,14 @@ struct pvr2_hdw { int tuner_updated; v4l2_std_id video_std_avail; v4l2_std_id video_std_cur; - struct pvr2_ctl_def video_std_enum; + int video_std_dirty; + struct pvr2_ctl_info video_std_info_enum; + struct pvr2_ctl_info video_std_info_avail; + struct pvr2_ctl_info video_std_info_cur; struct v4l2_standard *std_defs; - const char **video_std_names; + const char **video_std_enum_names; + const char *video_std_mask_ptrs[32]; + char video_std_mask_names[32][10]; unsigned int std_cnt; int std_id; @@ -321,14 +319,44 @@ struct pvr2_hdw { int flag_bilingual; struct pvr2_audio_stat *audio_stat; - /* Every last bit of controllable state */ + /* Control state */ +#define VCREATE_DATA(lab) int lab##_val; int lab##_dirty + VCREATE_DATA(brightness); + VCREATE_DATA(contrast); + VCREATE_DATA(saturation); + VCREATE_DATA(hue); + VCREATE_DATA(volume); + VCREATE_DATA(balance); + VCREATE_DATA(bass); + VCREATE_DATA(treble); + VCREATE_DATA(mute); + VCREATE_DATA(srate); + VCREATE_DATA(audiobitrate); + VCREATE_DATA(audiocrc); + VCREATE_DATA(audioemphasis); + VCREATE_DATA(vbr); + VCREATE_DATA(videobitrate); + VCREATE_DATA(videopeak); + VCREATE_DATA(input); + VCREATE_DATA(audiomode); + VCREATE_DATA(res_hor); + VCREATE_DATA(res_ver); + VCREATE_DATA(interlace); + VCREATE_DATA(audiolayer); +#undef VCREATE_DATA + struct pvr2_ctrl *controls; }; int pvr2_hdw_commit_ctl_internal(struct pvr2_hdw *hdw); -int pvr2_ctrl_internal_set_value(struct pvr2_ctrl *cptr,int val); -int pvr2_ctrl_internal_get_value(struct pvr2_ctrl *cptr); +unsigned int pvr2_hdw_get_signal_status_internal(struct pvr2_hdw *); + +void pvr2_hdw_subsys_bit_chg_no_lock(struct pvr2_hdw *hdw, + unsigned long msk,unsigned long val); +void pvr2_hdw_subsys_stream_bit_chg_no_lock(struct pvr2_hdw *hdw, + unsigned long msk, + unsigned long val); int pvr2_hdw_internal_set_stdenum_cur(struct pvr2_hdw *hdw,int val); void pvr2_hdw_internal_set_std_cur(struct pvr2_hdw *hdw,int msk); |