/*
* Copyright (C) 2005-2008 by Pieter Palmers
*
* This file is part of FFADO
* FFADO = Free Firewire (pro-)audio drivers for linux
*
* FFADO is based upon FreeBoB
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
*/
#include "efc_cmds_hardware.h"
#include
#include
using namespace std;
namespace FireWorks {
EfcHardwareInfoCmd::EfcHardwareInfoCmd()
: EfcCmd(EFC_CAT_HARDWARE_INFO, EFC_CMD_HW_HWINFO_GET_CAPS)
, m_nb_out_groups( 0 )
, m_nb_in_groups( 0 )
{}
bool
EfcHardwareInfoCmd::serialize( Util::Cmd::IOSSerialize& se )
{
bool result=true;
// the length should be specified before
// the header is serialized
m_length=EFC_HEADER_LENGTH_QUADLETS;
result &= EfcCmd::serialize ( se );
return result;
}
bool
EfcHardwareInfoCmd::deserialize( Util::Cmd::IISDeserialize& de )
{
bool result=true;
uint32_t tmp;
result &= EfcCmd::deserialize ( de );
// the serialization is different from the deserialization
EFC_DESERIALIZE_AND_SWAP(de, &m_flags, result);
EFC_DESERIALIZE_AND_SWAP(de, &tmp, result);
m_guid=tmp;
m_guid <<= 32;
EFC_DESERIALIZE_AND_SWAP(de, &tmp, result);
m_guid |= tmp;
EFC_DESERIALIZE_AND_SWAP(de, &m_type, result);
EFC_DESERIALIZE_AND_SWAP(de, &m_version, result);
int i=0;
byte_t *vname=(byte_t *)m_vendor_name;
for (i=0; i= 1) {
EFC_DESERIALIZE_AND_SWAP(de, &m_fpga_version, result);
EFC_DESERIALIZE_AND_SWAP(de, &m_nb_1394_play_chan_2x, result);
EFC_DESERIALIZE_AND_SWAP(de, &m_nb_1394_rec_chan_2x, result);
EFC_DESERIALIZE_AND_SWAP(de, &m_nb_1394_play_chan_4x, result);
EFC_DESERIALIZE_AND_SWAP(de, &m_nb_1394_rec_chan_4x, result);
}
return result;
}
void
EfcHardwareInfoCmd::showEfcCmd()
{
EfcCmd::showEfcCmd();
debugOutput(DEBUG_LEVEL_NORMAL, "EFC HW CAPS info:\n");
debugOutput(DEBUG_LEVEL_NORMAL, " Flags : 0x%08X\n", m_flags);
debugOutput(DEBUG_LEVEL_NORMAL, " GUID : %016llX\n", m_guid);
debugOutput(DEBUG_LEVEL_NORMAL, " HwType : 0x%08X\n", m_type);
debugOutput(DEBUG_LEVEL_NORMAL, " Version : %lu\n", m_version);
debugOutput(DEBUG_LEVEL_NORMAL, " Vendor : %s\n", m_vendor_name);
debugOutput(DEBUG_LEVEL_NORMAL, " Model : %s\n", m_model_name);
debugOutput(DEBUG_LEVEL_NORMAL, " Supported Clocks : 0x%08X\n", m_supported_clocks);
debugOutput(DEBUG_LEVEL_NORMAL, " # 1394 Playback : %d\n", m_nb_1394_playback_channels);
debugOutput(DEBUG_LEVEL_NORMAL, " # 1394 Record : %d\n", m_nb_1394_record_channels);
debugOutput(DEBUG_LEVEL_NORMAL, " # Physical out : %d\n", m_nb_phys_audio_out);
debugOutput(DEBUG_LEVEL_NORMAL, " # Physical in : %d\n", m_nb_phys_audio_in);
unsigned int i=0;
debugOutput(DEBUG_LEVEL_NORMAL, " # Output Groups : %d\n", m_nb_out_groups);
for (i=0;i= 1) {
debugOutput(DEBUG_LEVEL_NORMAL, " FPGA version : 0x%08X\n", m_fpga_version);
debugOutput(DEBUG_LEVEL_NORMAL, " # 1394 Playback (x2) : %d\n", m_nb_1394_play_chan_2x);
debugOutput(DEBUG_LEVEL_NORMAL, " # 1394 Record (x2) : %d\n", m_nb_1394_rec_chan_2x);
debugOutput(DEBUG_LEVEL_NORMAL, " # 1394 Playback (x4) : %d\n", m_nb_1394_play_chan_4x);
debugOutput(DEBUG_LEVEL_NORMAL, " # 1394 Record (x4) : %d\n", m_nb_1394_rec_chan_4x);
}
}
// --- polled info command
EfcPolledValuesCmd::EfcPolledValuesCmd()
: EfcCmd(EFC_CAT_HARDWARE_INFO, EFC_CMD_HW_GET_POLLED)
, m_nb_output_meters ( 0 )
, m_nb_input_meters ( 0 )
{}
bool
EfcPolledValuesCmd::serialize( Util::Cmd::IOSSerialize& se )
{
bool result=true;
// the length should be specified before
// the header is serialized
m_length=EFC_HEADER_LENGTH_QUADLETS;
result &= EfcCmd::serialize ( se );
return result;
}
bool
EfcPolledValuesCmd::deserialize( Util::Cmd::IISDeserialize& de )
{
bool result=true;
result &= EfcCmd::deserialize ( de );
// the serialization is different from the deserialization
EFC_DESERIALIZE_AND_SWAP(de, &m_status, result);
EFC_DESERIALIZE_AND_SWAP(de, &m_detect_spdif, result);
EFC_DESERIALIZE_AND_SWAP(de, &m_detect_adat, result);
EFC_DESERIALIZE_AND_SWAP(de, &m_reserved3, result);
EFC_DESERIALIZE_AND_SWAP(de, &m_reserved4, result);
EFC_DESERIALIZE_AND_SWAP(de, &m_nb_output_meters, result);
EFC_DESERIALIZE_AND_SWAP(de, &m_nb_input_meters, result);
EFC_DESERIALIZE_AND_SWAP(de, &m_reserved5, result);
EFC_DESERIALIZE_AND_SWAP(de, &m_reserved6, result);
int i=0;
int nb_meters=m_nb_output_meters+m_nb_input_meters;
assert(nb_meters