From 9f50cd5d60dc8af7b4f2efa592ded9769785fab8 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 25 Nov 1998 19:57:50 +0000 Subject: [PATCH] Changes for CS4237B/38B IEC-958 output setup... --- alsactl/alsactl_lexer.l | 4 ++-- alsactl/alsactl_parser.y | 18 ++++++++++++------ alsactl/setup.c | 4 ++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/alsactl/alsactl_lexer.l b/alsactl/alsactl_lexer.l index f16c767..8b39d3b 100644 --- a/alsactl/alsactl_lexer.l +++ b/alsactl/alsactl_lexer.l @@ -63,9 +63,9 @@ reset return L_RESET; user return L_USER; valid return L_VALID; data return L_DATA; -protected return L_PROTECT; +protect return L_PROTECT; pre2 return L_PRE2; -fslock return L_FSLOCK; +fsunlock return L_FSUNLOCK; type return L_TYPE; gstatus return L_GSTATUS; enable return L_ENABLE; diff --git a/alsactl/alsactl_parser.y b/alsactl/alsactl_parser.y index 7382e06..8bb3cbe 100644 --- a/alsactl/alsactl_parser.y +++ b/alsactl/alsactl_parser.y @@ -103,7 +103,7 @@ static unsigned short Xswitchiec958ocs1[16]; %token L_SOUNDCARD L_MIXER L_CHANNEL L_STEREO L_MONO L_SWITCH L_RAWDATA %token L_CONTROL L_PCM L_RAWMIDI L_PLAYBACK L_RECORD L_OUTPUT L_INPUT %token L_IEC958OCS L_3D L_RESET L_USER L_VALID L_DATA L_PROTECT L_PRE2 -%token L_FSLOCK L_TYPE L_GSTATUS L_ENABLE L_DISABLE L_MUTE L_SWOUT L_SWIN +%token L_FSUNLOCK L_TYPE L_GSTATUS L_ENABLE L_DISABLE L_MUTE L_SWOUT L_SWIN %type boolean %type integer @@ -262,9 +262,9 @@ iec958ocs1 : L_ENABLE { set_switch_iec958ocs( 0, 1, 0 ); } | L_USER { set_switch_iec958ocs( 4, 0x0020, ~0x0020 ); } | L_VALID { set_switch_iec958ocs( 4, 0x0010, ~0x0010 ); } | L_DATA { set_switch_iec958ocs( 5, 0x0002, ~0x0002 ); } - | L_PROTECT { set_switch_iec958ocs( 5, 0x0004, ~0x0004 ); } + | L_PROTECT { set_switch_iec958ocs( 5, 0, ~0x0004 ); } | L_PRE2 { set_switch_iec958ocs( 5, 0x0008, ~0x0018 ); } - | L_FSLOCK { set_switch_iec958ocs( 5, 0x0020, ~0x0020 ); } + | L_FSUNLOCK { set_switch_iec958ocs( 5, 0x0020, ~0x0020 ); } | L_TYPE '(' integer ')' { set_switch_iec958ocs( 5, ($3 & 0x7f) << 6, ~(0x7f<<6) ); } | L_GSTATUS { set_switch_iec958ocs( 5, 0x2000, ~0x2000 ); } | error { yyerror( "unknown keyword in iec958ocs1() arguments" ); } @@ -501,7 +501,7 @@ static void set_switch_iec958ocs_begin( int end ) /* ok.. this is a little bit wrong, but at these times are all switches same */ snd_ctl_switch_t *sw = (snd_ctl_switch_t *)Xswitch; - if ( !end ) { + if ( end ) { if ( Xswitchiec958ocs != sw -> value.enable ) { sw -> value.enable = Xswitchiec958ocs; *Xswitchchange = 1; @@ -514,6 +514,12 @@ static void set_switch_iec958ocs_begin( int end ) sw -> value.data16[5] = Xswitchiec958ocs1[5]; *Xswitchchange = 1; } +#if 0 + printf( "IEC958: enable = %i, ocs1[4] = 0x%x, ocs1[5] = 0x%x\n", + sw -> value.enable, + sw -> value.data16[4], + sw -> value.data16[5] ); +#endif return; } if ( Xswitchtype != SWITCH_MIXER || sw -> type != SND_MIXER_SW_TYPE_BOOLEAN || @@ -523,7 +529,7 @@ static void set_switch_iec958ocs_begin( int end ) yyerror( "Switch '%s' doesn't have Cirrus Logic signature!!!", sw -> name ); Xswitchiec958ocs = 0; Xswitchiec958ocs1[4] = 0x0000; - Xswitchiec958ocs1[5] = 0x0000; + Xswitchiec958ocs1[5] = 0x0004; /* copy permitted */ } static void set_switch_iec958ocs( int idx, unsigned short val, unsigned short mask ) @@ -532,6 +538,6 @@ static void set_switch_iec958ocs( int idx, unsigned short val, unsigned short ma Xswitchiec958ocs = val ? 1 : 0; return; } - Xswitchiec958ocs1[ idx ] &= ~mask; + Xswitchiec958ocs1[ idx ] &= mask; Xswitchiec958ocs1[ idx ] |= val; } diff --git a/alsactl/setup.c b/alsactl/setup.c index 07d9c55..3af19a5 100644 --- a/alsactl/setup.c +++ b/alsactl/setup.c @@ -576,12 +576,12 @@ static void soundcard_setup_write_switch( FILE *out, int interface, const unsign if ( pdata -> data16[4] & 0x0020 ) fprintf( out, " user" ); if ( pdata -> data16[4] & 0x0010 ) fprintf( out, " valid" ); if ( pdata -> data16[5] & 0x0002 ) fprintf( out, " data" ); - if ( !(pdata -> data16[5] & 0x0004) ) fprintf( out, " protected" ); + if ( !(pdata -> data16[5] & 0x0004) ) fprintf( out, " protect" ); switch ( pdata -> data16[5] & 0x0018 ) { case 0x0008: fprintf( out, " pre2" ); break; default: break; } - if ( pdata -> data16[5] & 0x0020 ) fprintf( out, " fslock" ); + if ( pdata -> data16[5] & 0x0020 ) fprintf( out, " fsunlock" ); fprintf( out, " type( 0x%x )", (pdata -> data16[5] >> 6) & 0x7f ); if ( pdata -> data16[5] & 0x2000 ) fprintf( out, " gstatus" ); fprintf( out, " )" );