root/trunk/libffado/src/libavc/general/avc_signal_format.cpp

Revision 2802, 3.9 kB (checked in by jwoithe, 3 years ago)

Cosmetic: "Firewire" becomes "FireWire?".

Officially both the "F" and "W" were capitalised in the FireWire? name, so
reflect this throughout FFADO's source tree. This mostly affects comments.

This patch originated from pander on the ffado-devel mailing list. To
maintain consistency, the committed version has been expanded to include
files not originally included in the original patch.

Line 
1 /*
2  * Copyright (C) 2005-2008 by Daniel Wagner
3  *
4  * This file is part of FFADO
5  * FFADO = Free FireWire (pro-)audio drivers for linux
6  *
7  * FFADO is based upon FreeBoB
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 2 of the License, or
12  * (at your option) version 3 of the License.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  */
23
24 #include "avc_signal_format.h"
25 #include "libutil/cmd_serialize.h"
26 #include "libieee1394/ieee1394service.h"
27
28 #include "libutil/ByteSwap.h"
29 #include <iostream>
30
31 #define AVC1394_CMD_INPUT_PLUG_SIGNAL_FORMAT 0x19
32 #define AVC1394_CMD_OUTPUT_PLUG_SIGNAL_FORMAT 0x18
33
34 using namespace std;
35
36 namespace AVC {
37
38 OutputPlugSignalFormatCmd::OutputPlugSignalFormatCmd(Ieee1394Service& ieee1394service)
39     : AVCCommand( ieee1394service, AVC1394_CMD_OUTPUT_PLUG_SIGNAL_FORMAT )
40     , m_plug ( 0 )
41     , m_eoh  ( 1 )
42     , m_form ( 0 )
43     , m_fmt  ( 0 )
44 {
45     m_fdf[0]=0xFF;
46     m_fdf[1]=0xFF;
47     m_fdf[2]=0xFF;
48 }
49
50 OutputPlugSignalFormatCmd::~OutputPlugSignalFormatCmd()
51 {
52 }
53
54 bool
55 OutputPlugSignalFormatCmd::serialize( Util::Cmd::IOSSerialize& se )
56 {
57     bool result=true;
58     result &= AVCCommand::serialize( se );
59    
60     result &= se.write(m_plug,"OutputPlugSignalFormatCmd plug");
61    
62     byte_t tmp = ((m_eoh & 0x01)<<7);
63     tmp |= ((m_form & 0x01)<<6);
64     tmp |= (m_fmt & 0x3f);
65    
66     result &= se.write(tmp,"OutputPlugSignalFormatCmd eoh,form,fmt");
67    
68     result &= se.write(m_fdf[0],"OutputPlugSignalFormatCmd fdf[0]");
69     result &= se.write(m_fdf[1],"OutputPlugSignalFormatCmd fdf[1]");
70     result &= se.write(m_fdf[2],"OutputPlugSignalFormatCmd fdf[2]");
71
72     return result;
73 }
74
75 bool
76 OutputPlugSignalFormatCmd::deserialize( Util::Cmd::IISDeserialize& de )
77 {
78     bool result=true;
79     result &= AVCCommand::deserialize( de );
80     result &= de.read(&m_plug);
81    
82     byte_t tmp;
83     result &= de.read(&tmp);
84    
85     m_eoh=((tmp & 0x80)>>7);
86     m_form=((tmp & 0x40)>>6);
87     m_fmt=tmp & 0x3f;
88    
89     result &= de.read(&m_fdf[0]);
90     result &= de.read(&m_fdf[1]);
91     result &= de.read(&m_fdf[2]);
92    
93     return result;
94 }
95
96 //------------------------
97
98 InputPlugSignalFormatCmd::InputPlugSignalFormatCmd(Ieee1394Service& ieee1394service)
99     : AVCCommand( ieee1394service, AVC1394_CMD_INPUT_PLUG_SIGNAL_FORMAT )
100     , m_plug ( 0 )
101     , m_eoh  ( 1 )
102     , m_form ( 0 )
103     , m_fmt  ( 0 )
104 {
105     m_fdf[0]=0xFF;
106     m_fdf[1]=0xFF;
107     m_fdf[2]=0xFF;
108 }
109
110 InputPlugSignalFormatCmd::~InputPlugSignalFormatCmd()
111 {
112 }
113
114 bool
115 InputPlugSignalFormatCmd::serialize( Util::Cmd::IOSSerialize& se )
116 {
117     bool result=true;
118     result &= AVCCommand::serialize( se );
119    
120     result &= se.write(m_plug,"InputPlugSignalFormatCmd plug");
121    
122     byte_t tmp = ((m_eoh& 0x01)<<7);
123     tmp |= ((m_form& 0x01)<<6);
124     tmp |= (m_fmt& 0x3f);
125    
126     result &= se.write(tmp,"InputPlugSignalFormatCmd eoh,form,fmt");
127    
128     result &= se.write(m_fdf[0],"InputPlugSignalFormatCmd fdf[0]");
129     result &= se.write(m_fdf[1],"InputPlugSignalFormatCmd fdf[1]");
130     result &= se.write(m_fdf[2],"InputPlugSignalFormatCmd fdf[2]");
131
132     return result;
133 }
134
135 bool
136 InputPlugSignalFormatCmd::deserialize( Util::Cmd::IISDeserialize& de )
137 {
138     bool result=true;
139     result &= AVCCommand::deserialize( de );
140     result &= de.read(&m_plug);
141    
142     byte_t tmp;
143     result &= de.read(&tmp);
144    
145     m_eoh=((tmp & 0x80)>>7);
146     m_form=((tmp & 0x40)>>6);
147     m_fmt=tmp & 0x3f;
148    
149     result &= de.read(&m_fdf[0]);
150     result &= de.read(&m_fdf[1]);
151     result &= de.read(&m_fdf[2]);
152    
153     return result;
154 }
155 }
Note: See TracBrowser for help on using the browser.