Changeset 1550
- Timestamp:
- 05/10/09 07:50:57 (14 years ago)
- Files:
-
- trunk/libffado/config_debug.h.in (modified) (1 diff)
- trunk/libffado/src/bounce/bounce_avdevice.h (modified) (3 diffs)
- trunk/libffado/src/bounce/bounce_slave_avdevice.cpp (modified) (2 diffs)
- trunk/libffado/src/bounce/bounce_slave_avdevice.h (modified) (1 diff)
- trunk/libffado/src/dice/dice_avdevice.cpp (modified) (27 diffs)
- trunk/libffado/src/dice/dice_avdevice.h (modified) (8 diffs)
- trunk/libffado/src/dice/dice_eap.cpp (added)
- trunk/libffado/src/dice/dice_eap.h (added)
- trunk/libffado/src/genericavc/avc_avdevice.cpp (modified) (3 diffs)
- trunk/libffado/src/genericavc/stanton (added)
- trunk/libffado/src/genericavc/stanton/scs.cpp (added)
- trunk/libffado/src/genericavc/stanton/scs.h (added)
- trunk/libffado/src/libieee1394/ARMHandler.cpp (modified) (6 diffs)
- trunk/libffado/src/libieee1394/ARMHandler.h (deleted)
- trunk/libffado/src/libieee1394/ieee1394service.cpp (modified) (25 diffs)
- trunk/libffado/src/libieee1394/ieee1394service.h (modified) (6 diffs)
- trunk/libffado/src/libieee1394/IsoHandlerManager.cpp (modified) (2 diffs)
- trunk/libffado/src/libieee1394/vendor_model_ids.h (modified) (2 diffs)
- trunk/libffado/src/libutil/ByteSwap.h (modified) (3 diffs)
- trunk/libffado/src/libutil/PosixThread.cpp (modified) (6 diffs)
- trunk/libffado/src/libutil/PosixThread.h (modified) (2 diffs)
- trunk/libffado/src/SConscript (modified) (2 diffs)
- trunk/libffado/support/alsa/SConscript (modified) (1 diff)
- trunk/libffado/tests/scan-devreg.cpp (modified) (6 diffs)
- trunk/libffado/tests/SConscript (modified) (1 diff)
- trunk/libffado/tests/test-ieee1394service.cpp (modified) (3 diffs)
- trunk/libffado/tests/test-scs.cpp (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/config_debug.h.in
r1498 r1550 13 13 14 14 // use an RT thread for reading out the messagebuffer. 15 // can reduce the number of buffer xruns, but not16 // recommended17 #define DEBUG_MESSAGE_BUFFER_REALTIME 015 // can reduce the number of buffer xruns, and 16 // avoids priority inversion issues 17 #define DEBUG_MESSAGE_BUFFER_REALTIME 1 18 18 #define DEBUG_MESSAGE_BUFFER_REALTIME_PRIO 1 19 19 trunk/libffado/src/bounce/bounce_avdevice.h
r1543 r1550 35 35 #include "libstreaming/amdtp/AmdtpPortInfo.h" 36 36 37 #include "libieee1394/ ARMHandler.h"37 #include "libieee1394/ieee1394service.h" 38 38 39 39 #include "ffadodevice.h" … … 54 54 class ConfigRom; 55 55 class DeviceManager; 56 57 namespace Util { 58 class Configuration; 59 } 56 60 57 61 namespace Bounce { … … 121 125 #define BOUNCE_NOTIFIER_BASE_ADDRESS 0x0000FFFFE0000000ULL 122 126 #define BOUNCE_NOTIFIER_BLOCK_LENGTH 4 123 class BounceNotifier : public ARMHandler127 class BounceNotifier : public Ieee1394Service::ARMHandler 124 128 { 125 129 public: 126 BounceNotifier(Device *, nodeaddr_t start);130 BounceNotifier(Device &, nodeaddr_t start); 127 131 virtual ~BounceNotifier(); 128 132 129 133 private: 130 Device *m_bouncedevice;134 Device &m_bouncedevice; 131 135 }; 132 136 }; trunk/libffado/src/bounce/bounce_slave_avdevice.cpp
r1543 r1550 126 126 } 127 127 128 m_Notifier=new SlaveDevice::BounceSlaveNotifier( this, notify_address);128 m_Notifier=new SlaveDevice::BounceSlaveNotifier(*this, notify_address); 129 129 130 130 if(!m_Notifier) { … … 443 443 // the notifier 444 444 445 SlaveDevice::BounceSlaveNotifier::BounceSlaveNotifier(SlaveDevice *d, nodeaddr_t start)446 : ARMHandler( start, BOUNCE_REGISTER_LENGTH,445 SlaveDevice::BounceSlaveNotifier::BounceSlaveNotifier(SlaveDevice &d, nodeaddr_t start) 446 : ARMHandler(d.get1394Service(), start, BOUNCE_REGISTER_LENGTH, 447 447 RAW1394_ARM_READ | RAW1394_ARM_WRITE, // allowed operations 448 448 0, //RAW1394_ARM_READ | RAW1394_ARM_WRITE, // operations to be notified of trunk/libffado/src/bounce/bounce_slave_avdevice.h
r1543 r1550 84 84 * hosts address space 85 85 */ 86 class BounceSlaveNotifier : public ARMHandler86 class BounceSlaveNotifier : public Ieee1394Service::ARMHandler 87 87 { 88 88 public: 89 BounceSlaveNotifier(SlaveDevice *, nodeaddr_t start);89 BounceSlaveNotifier(SlaveDevice &, nodeaddr_t start); 90 90 virtual ~BounceSlaveNotifier(); 91 91 92 92 private: 93 SlaveDevice *m_bounceslavedevice;93 SlaveDevice &m_bounceslavedevice; 94 94 }; 95 95 }; trunk/libffado/src/dice/dice_avdevice.cpp
r1543 r1550 571 571 debugOutput(DEBUG_LEVEL_NORMAL," Samplerate : 0x%08X (%lu)\n",tmp_quadlet,tmp_quadlet); 572 572 573 readGlobalRegBlock(DICE_REGISTER_GLOBAL_VERSION, reinterpret_cast<fb_quadlet_t *>(&tmp_quadlet), sizeof(fb_quadlet_t)); 574 debugOutput(DEBUG_LEVEL_NORMAL," Version : 0x%08X\n", tmp_quadlet); 575 573 576 readGlobalReg(DICE_REGISTER_GLOBAL_VERSION, &tmp_quadlet); 574 577 debugOutput(DEBUG_LEVEL_NORMAL," Version : 0x%08X (%u.%u.%u.%u)\n", … … 1026 1029 } 1027 1030 1028 m_notifier =new Device::DiceNotifier(this, notify_address);1031 m_notifier = new Device::Notifier(*this, notify_address); 1029 1032 1030 1033 if(!m_notifier) { … … 1438 1441 char namestring[DICE_TX_NAMES_SIZE+1]; 1439 1442 1440 if (!readTxRegBlock Swapped(i, DICE_REGISTER_TX_NAMES_BASE,1443 if (!readTxRegBlock(i, DICE_REGISTER_TX_NAMES_BASE, 1441 1444 (fb_quadlet_t *)namestring, DICE_TX_NAMES_SIZE)) { 1442 1445 debugError("Could not read TX name string \n"); … … 1444 1447 } 1445 1448 1449 // Strings from the device are always little-endian, 1450 // so byteswap for big-endian machines 1451 #if __BYTE_ORDER == __BIG_ENDIAN 1452 byteSwapBlock((quadlet_t *)namestring, DICE_TX_NAMES_SIZE/4); 1453 #endif 1446 1454 namestring[DICE_TX_NAMES_SIZE]='\0'; 1447 1455 return splitNameString(std::string(namestring)); … … 1453 1461 char namestring[DICE_RX_NAMES_SIZE+1]; 1454 1462 1455 if (!readRxRegBlock Swapped(i, DICE_REGISTER_RX_NAMES_BASE,1463 if (!readRxRegBlock(i, DICE_REGISTER_RX_NAMES_BASE, 1456 1464 (fb_quadlet_t *)namestring, DICE_RX_NAMES_SIZE)) { 1457 1465 debugError("Could not read RX name string \n"); … … 1459 1467 } 1460 1468 1469 // Strings from the device are always little-endian, 1470 // so byteswap for big-endian machines 1471 #if __BYTE_ORDER == __BIG_ENDIAN 1472 byteSwapBlock((quadlet_t *)namestring, DICE_RX_NAMES_SIZE/4); 1473 #endif 1461 1474 namestring[DICE_RX_NAMES_SIZE]='\0'; 1462 1475 return splitNameString(std::string(namestring)); … … 1468 1481 char namestring[DICE_CLOCKSOURCENAMES_SIZE+1]; 1469 1482 1470 if (!readGlobalRegBlock Swapped(DICE_REGISTER_GLOBAL_CLOCKSOURCENAMES,1483 if (!readGlobalRegBlock(DICE_REGISTER_GLOBAL_CLOCKSOURCENAMES, 1471 1484 (fb_quadlet_t *)namestring, DICE_CLOCKSOURCENAMES_SIZE)) { 1472 1485 debugError("Could not read CLOCKSOURCE name string \n"); … … 1474 1487 } 1475 1488 1489 // Strings from the device are always little-endian, 1490 // so byteswap for big-endian machines 1491 #if __BYTE_ORDER == __BIG_ENDIAN 1492 byteSwapBlock((quadlet_t *)namestring, DICE_CLOCKSOURCENAMES_SIZE/4); 1493 #endif 1476 1494 namestring[DICE_CLOCKSOURCENAMES_SIZE]='\0'; 1477 1495 return splitNameString(std::string(namestring)); … … 1482 1500 char namestring[DICE_NICK_NAME_SIZE+1]; 1483 1501 1484 if (!readGlobalRegBlock Swapped(DICE_REGISTER_GLOBAL_NICK_NAME,1502 if (!readGlobalRegBlock(DICE_REGISTER_GLOBAL_NICK_NAME, 1485 1503 (fb_quadlet_t *)namestring, DICE_NICK_NAME_SIZE)) { 1486 1504 debugError("Could not read nickname string \n"); … … 1488 1506 } 1489 1507 1508 // Strings from the device are always little-endian, 1509 // so byteswap for big-endian machines 1510 #if __BYTE_ORDER == __BIG_ENDIAN 1511 byteSwapBlock((quadlet_t *)namestring, DICE_NICK_NAME_SIZE/4); 1512 #endif 1490 1513 namestring[DICE_NICK_NAME_SIZE]='\0'; 1491 1514 return std::string(namestring); … … 1497 1520 strncpy(namestring, name.c_str(), DICE_NICK_NAME_SIZE); 1498 1521 1499 if (!writeGlobalRegBlockSwapped(DICE_REGISTER_GLOBAL_NICK_NAME, 1522 // Strings from the device are always little-endian, 1523 // so byteswap for big-endian machines 1524 #if __BYTE_ORDER == __BIG_ENDIAN 1525 byteSwapBlock((quadlet_t *)namestring, DICE_NICK_NAME_SIZE/4); 1526 #endif 1527 1528 if (!writeGlobalRegBlock(DICE_REGISTER_GLOBAL_NICK_NAME, 1500 1529 (fb_quadlet_t *)namestring, DICE_NICK_NAME_SIZE)) { 1501 1530 debugError("Could not write nickname string \n"); … … 1510 1539 1511 1540 // find the end of the string 1512 string::size_type end =in.find(string("\\\\"));1541 string::size_type end = in.find(string("\\\\")); 1513 1542 // cut the end 1514 in =in.substr(0,end);1543 in = in.substr(0,end); 1515 1544 1516 1545 string::size_type cut; … … 1533 1562 1534 1563 // offsets and sizes are returned in quadlets, but we use byte values 1535 1536 1564 if(!readReg(DICE_REGISTER_GLOBAL_PAR_SPACE_OFF, &m_global_reg_offset)) { 1537 1565 debugError("Could not initialize m_global_reg_offset\n"); … … 1648 1676 } 1649 1677 1650 fb_nodeaddr_t addr =DICE_REGISTER_BASE + offset;1651 fb_nodeid_t nodeId =getNodeId() | 0xFFC0;1678 fb_nodeaddr_t addr = DICE_REGISTER_BASE + offset; 1679 fb_nodeid_t nodeId = getNodeId() | 0xFFC0; 1652 1680 1653 1681 if(!get1394Service().read_quadlet( nodeId, addr, result ) ) { … … 1656 1684 } 1657 1685 1658 *result =CondSwapFromBus32(*result);1686 *result = CondSwapFromBus32(*result); 1659 1687 1660 1688 debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"Read result: 0x%08X\n", *result); … … 1673 1701 } 1674 1702 1675 fb_nodeaddr_t addr =DICE_REGISTER_BASE + offset;1676 fb_nodeid_t nodeId =getNodeId() | 0xFFC0;1703 fb_nodeaddr_t addr = DICE_REGISTER_BASE + offset; 1704 fb_nodeid_t nodeId = getNodeId() | 0xFFC0; 1677 1705 1678 1706 if(!get1394Service().write_quadlet( nodeId, addr, CondSwapToBus32(data) ) ) { … … 1685 1713 bool 1686 1714 Device::readRegBlock(fb_nodeaddr_t offset, fb_quadlet_t *data, size_t length) { 1687 debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"Reading base register offset 0x%08llX, length %u\n", 1688 offset, length); 1715 debugOutput(DEBUG_LEVEL_VERBOSE,"Reading base register offset 0x%08llX, length %u, to %p\n", 1716 offset, length, data); 1717 const int blocksize_quads = 512/4; 1689 1718 1690 1719 if(offset >= DICE_INVALID_OFFSET) { … … 1693 1722 } 1694 1723 1695 fb_nodeaddr_t addr=DICE_REGISTER_BASE + offset; 1696 fb_nodeid_t nodeId=getNodeId() | 0xFFC0; 1697 1698 if(!get1394Service().read( nodeId, addr, length/4, data ) ) { 1699 debugError("Could not read from node 0x%04X addr 0x%012llX\n", nodeId, addr); 1700 return false; 1701 } 1702 1703 for(unsigned int i=0;i<length/4;i++) { 1704 *(data+i)=CondSwapFromBus32(*(data+i)); 1705 } 1706 1724 fb_nodeaddr_t addr = DICE_REGISTER_BASE + offset; 1725 fb_nodeid_t nodeId = getNodeId() | 0xFFC0; 1726 int quads_done = 0; 1727 // round to next full quadlet 1728 int length_quads = (length+3)/4; 1729 while(quads_done < length_quads) { 1730 fb_nodeaddr_t curr_addr = addr + quads_done*4; 1731 fb_quadlet_t *curr_data = data + quads_done; 1732 int quads_todo = length_quads - quads_done; 1733 debugOutput(DEBUG_LEVEL_VERBOSE, "reading addr: 0x%016llX, %d quads to %p\n", curr_addr, quads_todo, curr_data); 1734 1735 if (quads_todo > blocksize_quads) { 1736 debugOutput(DEBUG_LEVEL_VERBOSE, "Truncating read from %d to %d quadlets\n", quads_todo, blocksize_quads); 1737 quads_todo = blocksize_quads; 1738 } 1739 #ifdef DEBUG 1740 if (quads_todo < 0) { 1741 debugError("BUG: quads_todo < 0: %d\n", quads_todo); 1742 } 1743 #endif 1744 1745 if(!get1394Service().read( nodeId, curr_addr, quads_todo, curr_data ) ) { 1746 debugError("Could not read %d quadlets from node 0x%04X addr 0x%012llX\n", nodeId, quads_todo, curr_addr); 1747 return false; 1748 } 1749 quads_done += quads_todo; 1750 } 1751 1752 byteSwapFromBus(data, length/4); 1707 1753 return true; 1708 1754 } … … 1712 1758 debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"Writing base register offset 0x%08llX, length: %u\n", 1713 1759 offset, length); 1760 const int blocksize_quads = 512/4; 1714 1761 1715 1762 if(offset >= DICE_INVALID_OFFSET) { … … 1718 1765 } 1719 1766 1720 fb_nodeaddr_t addr=DICE_REGISTER_BASE + offset;1721 fb_nodeid_t nodeId=getNodeId() | 0xFFC0;1722 1723 1767 fb_quadlet_t data_out[length/4]; 1724 1725 for(unsigned int i=0;i<length/4;i++) { 1726 data_out[i]=CondSwapFromBus32(*(data+i)); 1727 } 1728 1729 if(!get1394Service().write( nodeId, addr, length/4, data_out ) ) { 1730 debugError("Could not write to node 0x%04X addr 0x%012llX\n", nodeId, addr); 1731 return false; 1732 } 1733 1734 return true; 1735 } 1736 1737 bool 1738 Device::readRegBlockSwapped(fb_nodeaddr_t offset, fb_quadlet_t *data, size_t length) { 1739 debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"Reading base register offset 0x%08llX, length %u\n", 1740 offset, length); 1741 1742 if(offset >= DICE_INVALID_OFFSET) { 1743 debugError("invalid offset: 0x%016llX\n", offset); 1744 return false; 1745 } 1746 1747 fb_nodeaddr_t addr=DICE_REGISTER_BASE + offset; 1748 fb_nodeid_t nodeId=getNodeId() | 0xFFC0; 1749 1750 if(!get1394Service().read( nodeId, addr, length/4, data ) ) { 1751 debugError("Could not read from node 0x%04X addr 0x%012llX\n", nodeId, addr); 1752 return false; 1753 } 1754 1755 for(unsigned int i=0;i<length/4;i++) { 1756 *(data+i)=ByteSwap32(*(data+i)); 1757 } 1758 1759 return true; 1760 } 1761 1762 bool 1763 Device::writeRegBlockSwapped(fb_nodeaddr_t offset, fb_quadlet_t *data, size_t length) { 1764 debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"Writing base register offset 0x%08llX, length: %u\n", 1765 offset, length); 1766 1767 if(offset >= DICE_INVALID_OFFSET) { 1768 debugError("invalid offset: 0x%016llX\n", offset); 1769 return false; 1770 } 1771 1772 fb_nodeaddr_t addr=DICE_REGISTER_BASE + offset; 1773 fb_nodeid_t nodeId=getNodeId() | 0xFFC0; 1774 1775 fb_quadlet_t data_out[length/4]; 1776 1777 for(unsigned int i=0;i<length/4;i++) { 1778 data_out[i]=ByteSwap32(*(data+i)); 1779 } 1780 1781 if(!get1394Service().write( nodeId, addr, length/4, data_out ) ) { 1782 debugError("Could not write to node 0x%04X addr 0x%012llX\n", nodeId, addr); 1783 return false; 1768 memcpy(data_out, data, length); 1769 byteSwapToBus(data_out, length/4); 1770 1771 fb_nodeaddr_t addr = DICE_REGISTER_BASE + offset; 1772 fb_nodeid_t nodeId = getNodeId() | 0xFFC0; 1773 int quads_done = 0; 1774 int length_quads = (length+3)/4; 1775 while(quads_done < length_quads) { 1776 fb_nodeaddr_t curr_addr = addr + quads_done*4; 1777 fb_quadlet_t *curr_data = data_out + quads_done; 1778 int quads_todo = length_quads - quads_done; 1779 if (quads_todo > blocksize_quads) { 1780 debugOutput(DEBUG_LEVEL_VERBOSE, "Truncating write from %d to %d quadlets\n", quads_todo, blocksize_quads); 1781 quads_todo = blocksize_quads; 1782 } 1783 #ifdef DEBUG 1784 if (quads_todo < 0) { 1785 debugError("BUG: quads_todo < 0: %d\n", quads_todo); 1786 } 1787 #endif 1788 1789 if(!get1394Service().write( nodeId, addr, quads_todo, curr_data ) ) { 1790 debugError("Could not write %d quadlets to node 0x%04X addr 0x%012llX\n", nodeId, quads_todo, curr_addr); 1791 return false; 1792 } 1793 quads_done += quads_todo; 1784 1794 } 1785 1795 … … 1791 1801 debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"Reading global register offset 0x%04llX\n", offset); 1792 1802 1793 fb_nodeaddr_t offset_gl =globalOffsetGen(offset, sizeof(fb_quadlet_t));1803 fb_nodeaddr_t offset_gl = globalOffsetGen(offset, sizeof(fb_quadlet_t)); 1794 1804 return readReg(m_global_reg_offset + offset_gl, result); 1795 1805 } … … 1800 1810 offset, data); 1801 1811 1802 fb_nodeaddr_t offset_gl =globalOffsetGen(offset, sizeof(fb_quadlet_t));1812 fb_nodeaddr_t offset_gl = globalOffsetGen(offset, sizeof(fb_quadlet_t)); 1803 1813 return writeReg(m_global_reg_offset + offset_gl, data); 1804 1814 } … … 1809 1819 offset, length); 1810 1820 1811 fb_nodeaddr_t offset_gl =globalOffsetGen(offset, length);1821 fb_nodeaddr_t offset_gl = globalOffsetGen(offset, length); 1812 1822 return readRegBlock(m_global_reg_offset + offset_gl, data, length); 1813 1823 } … … 1818 1828 offset, length); 1819 1829 1820 fb_nodeaddr_t offset_gl =globalOffsetGen(offset, length);1830 fb_nodeaddr_t offset_gl = globalOffsetGen(offset, length); 1821 1831 return writeRegBlock(m_global_reg_offset + offset_gl, data, length); 1822 }1823 1824 bool1825 Device::readGlobalRegBlockSwapped(fb_nodeaddr_t offset, fb_quadlet_t *data, size_t length) {1826 debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"Reading global register block offset 0x%04llX, length %u bytes\n",1827 offset, length);1828 1829 fb_nodeaddr_t offset_gl=globalOffsetGen(offset, length);1830 return readRegBlockSwapped(m_global_reg_offset + offset_gl, data, length);1831 }1832 1833 bool1834 Device::writeGlobalRegBlockSwapped(fb_nodeaddr_t offset, fb_quadlet_t *data, size_t length) {1835 debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"Writing global register block offset 0x%04llX, length %u bytes\n",1836 offset, length);1837 1838 fb_nodeaddr_t offset_gl=globalOffsetGen(offset, length);1839 return writeRegBlockSwapped(m_global_reg_offset + offset_gl, data, length);1840 1832 } 1841 1833 … … 1891 1883 fb_nodeaddr_t offset_tx=txOffsetGen(i, offset, length); 1892 1884 return writeRegBlock(m_tx_reg_offset + offset_tx, data, length); 1893 }1894 1895 bool1896 Device::readTxRegBlockSwapped(unsigned int i, fb_nodeaddr_t offset, fb_quadlet_t *data, size_t length) {1897 debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"Reading rx register block offset 0x%04llX, length %u bytes\n",1898 offset, length);1899 1900 fb_nodeaddr_t offset_tx=txOffsetGen(i, offset, length);1901 return readRegBlockSwapped(m_tx_reg_offset + offset_tx, data, length);1902 1885 } 1903 1886 … … 1969 1952 } 1970 1953 1971 bool1972 Device::readRxRegBlockSwapped(unsigned int i, fb_nodeaddr_t offset, fb_quadlet_t *data, size_t length) {1973 debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"Reading rx register block offset 0x%04llX, length %u bytes\n",1974 offset, length);1975 1976 fb_nodeaddr_t offset_rx=rxOffsetGen(i, offset, length);1977 return readRegBlockSwapped(m_rx_reg_offset + offset_rx, data, length);1978 }1979 1980 1954 fb_nodeaddr_t 1981 1955 Device::rxOffsetGen(unsigned int i, fb_nodeaddr_t offset, size_t length) { … … 2012 1986 // the notifier 2013 1987 2014 Device:: DiceNotifier::DiceNotifier(Device *d, nodeaddr_t start)2015 : ARMHandler( start, DICE_NOTIFIER_BLOCK_LENGTH,1988 Device::Notifier::Notifier(Device &d, nodeaddr_t start) 1989 : ARMHandler(d.get1394Service(), start, DICE_NOTIFIER_BLOCK_LENGTH, 2016 1990 RAW1394_ARM_READ | RAW1394_ARM_WRITE | RAW1394_ARM_LOCK, 2017 1991 RAW1394_ARM_WRITE, 0) 2018 , m_d icedevice(d)1992 , m_device(d) 2019 1993 { 2020 2021 } 2022 2023 Device::DiceNotifier::~DiceNotifier() 1994 // switch over the debug module to that of this device instead of the 1394 service 1995 m_debugModule = d.m_debugModule; 1996 } 1997 1998 Device::Notifier::~Notifier() 2024 1999 { 2025 2000 trunk/libffado/src/dice/dice_avdevice.h
r1543 r1550 33 33 #include "libstreaming/amdtp/AmdtpTransmitStreamProcessor.h" 34 34 #include "libstreaming/amdtp/AmdtpPort.h" 35 #include "libieee1394/ARMHandler.h" 35 36 #include "libieee1394/ieee1394service.h" 36 37 37 38 #include <string> … … 41 42 class Ieee1394Service; 42 43 44 namespace Util { 45 class Configuration; 46 } 47 43 48 namespace Dice { 44 49 45 class DiceNotifier;50 class Notifier; 46 51 47 52 class Device : public FFADODevice { 48 private: 49 class DiceNotifier; 53 // private: 54 public: 55 class Notifier; 56 class EAP; 57 50 58 public: 51 59 Device( DeviceManager& d, std::auto_ptr<ConfigRom>( configRom )); … … 141 149 bool readRegBlock(fb_nodeaddr_t, fb_quadlet_t *, size_t); 142 150 bool writeRegBlock(fb_nodeaddr_t, fb_quadlet_t *, size_t); 143 bool readRegBlockSwapped(fb_nodeaddr_t, fb_quadlet_t *, size_t);144 bool writeRegBlockSwapped(fb_nodeaddr_t, fb_quadlet_t *, size_t);145 151 146 152 bool readGlobalReg(fb_nodeaddr_t, fb_quadlet_t *); … … 148 154 bool readGlobalRegBlock(fb_nodeaddr_t, fb_quadlet_t *, size_t); 149 155 bool writeGlobalRegBlock(fb_nodeaddr_t, fb_quadlet_t *, size_t); 150 bool readGlobalRegBlockSwapped(fb_nodeaddr_t, fb_quadlet_t *, size_t);151 bool writeGlobalRegBlockSwapped(fb_nodeaddr_t, fb_quadlet_t *, size_t);152 156 fb_nodeaddr_t globalOffsetGen(fb_nodeaddr_t, size_t); 153 157 … … 156 160 bool readTxRegBlock(unsigned int i, fb_nodeaddr_t offset, fb_quadlet_t *data, size_t length); 157 161 bool writeTxRegBlock(unsigned int i, fb_nodeaddr_t offset, fb_quadlet_t *data, size_t length); 158 bool readTxRegBlockSwapped(unsigned int i, fb_nodeaddr_t offset, fb_quadlet_t *data, size_t length);159 162 fb_nodeaddr_t txOffsetGen(unsigned int, fb_nodeaddr_t, size_t); 160 163 … … 163 166 bool readRxRegBlock(unsigned int i, fb_nodeaddr_t offset, fb_quadlet_t *data, size_t length); 164 167 bool writeRxRegBlock(unsigned int i, fb_nodeaddr_t offset, fb_quadlet_t *data, size_t length); 165 bool readRxRegBlockSwapped(unsigned int i, fb_nodeaddr_t offset, fb_quadlet_t *data, size_t length);166 168 fb_nodeaddr_t rxOffsetGen(unsigned int, fb_nodeaddr_t, size_t); 167 169 … … 182 184 fb_quadlet_t m_rx_size; 183 185 184 private: 186 // private: 187 public: 185 188 // notification 186 DiceNotifier *m_notifier;189 Notifier *m_notifier; 187 190 188 191 /** … … 192 195 #define DICE_NOTIFIER_BASE_ADDRESS 0x0000FFFFE0000000ULL 193 196 #define DICE_NOTIFIER_BLOCK_LENGTH 4 194 class DiceNotifier : publicARMHandler197 class Notifier : public Ieee1394Service::ARMHandler 195 198 { 196 199 public: 197 DiceNotifier(Device *, nodeaddr_t start);198 virtual ~ DiceNotifier();200 Notifier(Device &, nodeaddr_t start); 201 virtual ~Notifier(); 199 202 200 203 private: 201 Device *m_dicedevice;204 Device &m_device; 202 205 }; 206 207 /** 208 * this class represents the EAP interface 209 * available on some devices 210 */ 211 class EAP 212 { 213 public: 214 class Router; 215 class Mixer; 216 217 private: 218 enum eWaitReturn { 219 eWR_Error, 220 eWR_Timeout, 221 eWR_Busy, 222 eWR_Done, 223 }; 224 enum eRegBase { 225 eRT_Base, 226 eRT_Capability, 227 eRT_Command, 228 eRT_Mixer, 229 eRT_Peak, 230 eRT_NewRouting, 231 eRT_NewStreamCfg, 232 eRT_CurrentCfg, 233 eRT_Standalone, 234 eRT_Application, 235 }; 236 237 public: 238 EAP(Device &); 239 virtual ~EAP(); 240 241 static bool supportsEAP(Device &); 242 bool init(); 243 244 void show(); 245 enum eWaitReturn operationBusy(); 246 enum eWaitReturn waitForOperationEnd(int max_wait_time_ms = 100); 247 bool loadRouterConfig(bool low, bool mid, bool high); 248 bool loadStreamConfig(bool low, bool mid, bool high); 249 bool loadRouterAndStreamConfig(bool low, bool mid, bool high); 250 bool loadFlashConfig(); 251 bool storeFlashConfig(); 252 253 private: 254 bool m_router_exposed; 255 bool m_router_readonly; 256 bool m_router_flashstored; 257 uint16_t m_router_nb_entries; 258 259 bool m_mixer_exposed; 260 bool m_mixer_readonly; 261 bool m_mixer_flashstored; 262 uint8_t m_mixer_input_id; 263 uint8_t m_mixer_output_id; 264 uint8_t m_mixer_nb_inputs; 265 uint8_t m_mixer_nb_outputs; 266 267 bool m_general_support_dynstream; 268 bool m_general_support_flash; 269 bool m_general_peak_enabled; 270 uint8_t m_general_max_tx; 271 uint8_t m_general_max_rx; 272 bool m_general_stream_cfg_stored; 273 uint16_t m_general_chip; 274 275 bool commandHelper(fb_quadlet_t cmd); 276 277 bool readReg(enum eRegBase, unsigned offset, quadlet_t *); 278 bool writeReg(enum eRegBase, unsigned offset, quadlet_t); 279 bool readRegBlock(enum eRegBase, unsigned, fb_quadlet_t *, size_t); 280 bool writeRegBlock(enum eRegBase, unsigned, fb_quadlet_t *, size_t); 281 bool readRegBlockSwapped(enum eRegBase, unsigned, fb_quadlet_t *, size_t); 282 bool writeRegBlockSwapped(enum eRegBase, unsigned, fb_quadlet_t *, size_t); 283 fb_nodeaddr_t offsetGen(enum eRegBase, unsigned, size_t); 284 285 Device &m_device; 286 DECLARE_DEBUG_MODULE_REFERENCE; 287 288 fb_quadlet_t m_capability_offset; 289 fb_quadlet_t m_capability_size; 290 fb_quadlet_t m_cmd_offset; 291 fb_quadlet_t m_cmd_size; 292 fb_quadlet_t m_mixer_offset; 293 fb_quadlet_t m_mixer_size; 294 fb_quadlet_t m_peak_offset; 295 fb_quadlet_t m_peak_size; 296 fb_quadlet_t m_new_routing_offset; 297 fb_quadlet_t m_new_routing_size; 298 fb_quadlet_t m_new_stream_cfg_offset; 299 fb_quadlet_t m_new_stream_cfg_size; 300 fb_quadlet_t m_curr_cfg_offset; 301 fb_quadlet_t m_curr_cfg_size; 302 fb_quadlet_t m_standalone_offset; 303 fb_quadlet_t m_standalone_size; 304 fb_quadlet_t m_app_offset; 305 fb_quadlet_t m_app_size; 306 307 public: // mixer subclass 308 class Mixer { 309 public: 310 Mixer(EAP &); 311 ~Mixer(); 312 313 bool init(); 314 void show(); 315 bool updateCoefficients(); 316 317 private: 318 EAP &m_parent; 319 fb_quadlet_t *m_coeff; 320 321 DECLARE_DEBUG_MODULE_REFERENCE; 322 }; 323 324 class Router { 325 public: 326 Router(EAP &); 327 ~Router(); 328 329 bool init(); 330 void show(); 331 332 private: 333 EAP &m_parent; 334 335 DECLARE_DEBUG_MODULE_REFERENCE; 336 }; 337 338 }; 339 203 340 }; 204 341 trunk/libffado/src/genericavc/avc_avdevice.cpp
r1543 r1550 23 23 */ 24 24 25 //#include "config.h"26 25 #include "devicemanager.h" 27 26 #include "genericavc/avc_avdevice.h" … … 45 44 46 45 #include <libraw1394/csr.h> 46 47 #include "stanton/scs.h" 47 48 48 49 namespace GenericAVC { … … 109 110 Device::createDevice(DeviceManager& d, std::auto_ptr<ConfigRom>( configRom )) 110 111 { 111 return new Device(d, configRom ); 112 unsigned int vendorId = configRom->getNodeVendorId(); 113 unsigned int modelId = configRom->getModelId(); 114 115 switch (vendorId) { 116 case FW_VENDORID_STANTON: 117 if (modelId == 0x00001000 ) { 118 return new Stanton::ScsDevice(d, configRom); 119 } 120 default: 121 return new GenericAVC::Device(d, configRom); 122 } 123 return NULL; 112 124 } 113 125 trunk/libffado/src/libieee1394/ARMHandler.cpp
r1234 r1550 25 25 #include <cstdlib> 26 26 27 #include " ARMHandler.h"27 #include "ieee1394service.h" 28 28 29 IMPL_DEBUG_MODULE( ARMHandler, ARMHandler, DEBUG_LEVEL_NORMAL);30 29 /** 30 * @param parent the 1394service that created this handler 31 31 * @param start identifies addressrange 32 32 * @param length identifies addressrange length (in bytes) … … 49 49 * 50 50 */ 51 ARMHandler::ARMHandler(nodeaddr_t start, size_t length, 52 unsigned int access_rights, 53 unsigned int notification_options, 54 unsigned int client_transactions 55 ) 56 : m_start(start), 57 m_length(length), 58 m_access_rights(access_rights), 59 m_notification_options(notification_options), 60 m_client_transactions(client_transactions), 61 m_buffer(0) 51 Ieee1394Service::ARMHandler::ARMHandler(Ieee1394Service &parent, 52 nodeaddr_t start, size_t length, 53 unsigned int access_rights, 54 unsigned int notification_options, 55 unsigned int client_transactions) 56 : m_parent(parent) 57 , m_start(start) 58 , m_length(length) 59 , m_access_rights(access_rights) 60 , m_notification_options(notification_options) 61 , m_client_transactions(client_transactions) 62 , m_buffer(0) 63 , m_debugModule(parent.m_debugModule) 62 64 { 63 m_buffer =(byte_t*)calloc(length, sizeof(byte_t));64 memset(&m_response, 0,sizeof(m_response));65 m_buffer = (byte_t*)calloc(length, sizeof(byte_t)); 66 memset(&m_response, 0, sizeof(m_response)); 65 67 } 66 68 67 ARMHandler::~ARMHandler() {69 Ieee1394Service::ARMHandler::~ARMHandler() { 68 70 if(m_buffer) 69 71 delete m_buffer; 70 72 } 71 73 72 bool ARMHandler::handleRead(struct raw1394_arm_request *req) { 74 bool 75 Ieee1394Service::ARMHandler::handleRead(struct raw1394_arm_request *req) { 73 76 debugOutput(DEBUG_LEVEL_VERBOSE, "Read\n"); 74 77 printRequest(req); … … 76 79 } 77 80 78 bool ARMHandler::handleWrite(struct raw1394_arm_request *req) { 81 bool 82 Ieee1394Service::ARMHandler::handleWrite(struct raw1394_arm_request *req) { 79 83 debugOutput(DEBUG_LEVEL_VERBOSE, "Write\n"); 80 84 printRequest(req); … … 82 86 } 83 87 84 bool ARMHandler::handleLock(struct raw1394_arm_request *req) { 88 bool 89 Ieee1394Service::ARMHandler::handleLock(struct raw1394_arm_request *req) { 85 90 debugOutput(DEBUG_LEVEL_VERBOSE, "Lock\n"); 86 91 printRequest(req); … … 111 116 // } *raw1394_arm_request_response_t; 112 117 113 void ARMHandler::printRequest(struct raw1394_arm_request *arm_req) { 118 void 119 Ieee1394Service::ARMHandler::printRequest(struct raw1394_arm_request *arm_req) { 114 120 debugOutput(DEBUG_LEVEL_VERBOSE, " request info: \n"); 115 121 debugOutput(DEBUG_LEVEL_VERBOSE, " from node 0x%04X to node 0x%04X\n", … … 125 131 126 132 void 127 ARMHandler::printBufferBytes( unsigned int level, size_t length, byte_t* buffer ) const133 Ieee1394Service::ARMHandler::printBufferBytes( unsigned int level, size_t length, byte_t* buffer ) const 128 134 { 129 135 trunk/libffado/src/libieee1394/ieee1394service.cpp
r1535 r1550 26 26 27 27 #include "ieee1394service.h" 28 #include "ARMHandler.h"29 28 #include "cycletimer.h" 30 29 #include "IsoHandlerManager.h" … … 37 36 #include "libutil/Watchdog.h" 38 37 #include "libutil/PosixMutex.h" 38 #include "libutil/PosixThread.h" 39 39 #include "libutil/Configuration.h" 40 40 … … 53 53 Ieee1394Service::Ieee1394Service() 54 54 : m_configuration( NULL ) 55 , m_resetHelper( NULL ) 56 , m_armHelperNormal( NULL ) 57 , m_armHelperRealtime( NULL ) 55 58 , m_handle( 0 ) 56 59 , m_handle_lock( new Util::PosixMutex("SRCVHND") ) 57 , m_resetHandle( 0 )58 60 , m_util_handle( 0 ) 59 61 , m_port( -1 ) 60 , m_RHThread_lock( new Util::PosixMutex("SRVCRH") )61 , m_threadRunning( false )62 62 , m_realtime ( false ) 63 63 , m_base_priority ( 0 ) … … 81 81 Ieee1394Service::Ieee1394Service(bool rt, int prio) 82 82 : m_configuration( NULL ) 83 , m_resetHelper( NULL ) 84 , m_armHelperNormal( NULL ) 85 , m_armHelperRealtime( NULL ) 83 86 , m_handle( 0 ) 84 87 , m_handle_lock( new Util::PosixMutex("SRCVHND") ) 85 , m_resetHandle( 0 )86 88 , m_util_handle( 0 ) 87 89 , m_port( -1 ) 88 , m_RHThread_lock( new Util::PosixMutex("SRVCRH") )89 , m_threadRunning( false )90 90 , m_realtime ( rt ) 91 91 , m_base_priority ( prio ) … … 113 113 delete m_pIsoManager; 114 114 delete m_pCTRHelper; 115 stopRHThread(); 115 116 m_resetHelper->Stop(); 117 m_armHelperNormal->Stop(); 118 m_armHelperRealtime->Stop(); 119 116 120 for ( arm_handler_vec_t::iterator it = m_armHandlers.begin(); 117 121 it != m_armHandlers.end(); … … 119 123 { 120 124 debugOutput(DEBUG_LEVEL_VERBOSE, "Unregistering ARM handler for 0x%016llX\n", (*it)->getStart()); 121 int err=raw1394_arm_unregister(m_resetHandle, (*it)->getStart()); 122 if (err) { 123 debugError(" Failed to unregister ARM handler for 0x%016llX\n", (*it)->getStart()); 124 debugError(" Error: %s\n", strerror(errno)); 125 if(m_armHelperNormal) { 126 int err = raw1394_arm_unregister(m_armHelperNormal->get1394Handle(), (*it)->getStart()); 127 if (err) { 128 debugError(" Failed to unregister ARM handler for 0x%016llX\n", (*it)->getStart()); 129 debugError(" Error: %s\n", strerror(errno)); 130 } 131 } else { 132 debugWarning("ARM handler registered without valid ARM helper thread\n"); 125 133 } 126 134 } … … 132 140 delete m_handle_lock; 133 141 134 if ( m_resetHandle ) {135 raw1394_destroy_handle( m_resetHandle );136 }137 delete m_RHThread_lock; 142 if(m_resetHelper) delete m_resetHelper; 143 if(m_armHelperNormal) delete m_armHelperNormal; 144 if(m_armHelperRealtime) delete m_armHelperRealtime; 145 138 146 if ( m_util_handle ) { 139 147 raw1394_destroy_handle( m_util_handle ); … … 229 237 debugFatal("Requested port (%d) out of range (# ports: %d)\n", port, nb_ports); 230 238 } 239 m_port = port; 231 240 232 241 if(!m_pWatchdog) { … … 251 260 } 252 261 253 m_resetHandle = raw1394_new_handle_on_port( port ); 254 if ( !m_resetHandle ) { 255 if ( !errno ) { 256 debugFatal("libraw1394 not compatible\n"); 257 } else { 258 debugFatal("Ieee1394Service::initialize: Could not get 1394 handle: %s", 259 strerror(errno) ); 260 debugFatal("Is ieee1394 and raw1394 driver loaded?\n"); 261 } 262 return false; 263 } 264 262 // helper threads for all sorts of ASYNC events 263 // note: m_port has to be set! 264 m_resetHelper = new HelperThread(*this, "BUSRST"); 265 if ( !m_resetHelper ) { 266 debugFatal("Could not allocate busreset handler helper\n"); 267 return false; 268 } 269 m_armHelperNormal = new HelperThread(*this, "ARMSTD"); 270 if ( !m_armHelperNormal ) { 271 debugFatal("Could not allocate standard ARM handler helper\n"); 272 return false; 273 } 274 m_armHelperRealtime = new HelperThread(*this, "ARMRT", m_realtime, m_base_priority); 275 if ( !m_armHelperRealtime ) { 276 debugFatal("Could not allocate realtime ARM handler helper\n"); 277 return false; 278 } 279 280 // start helper threads 281 if(!m_resetHelper->Start()) { 282 debugFatal("Could not start busreset helper thread\n"); 283 return false; 284 } 285 if(!m_armHelperNormal->Start()) { 286 debugFatal("Could not start standard ARM helper thread\n"); 287 return false; 288 } 289 if(!m_armHelperRealtime->Start()) { 290 debugFatal("Could not start realtime ARM helper thread\n"); 291 return false; 292 } 293 294 // attach the reset and ARM handlers 295 // NOTE: the handlers have to be started first, or there is no 1394handle 296 raw1394_set_bus_reset_handler( m_resetHelper->get1394Handle(), 297 this->resetHandlerLowLevel ); 298 299 m_default_arm_handler = raw1394_set_arm_tag_handler( m_armHelperNormal->get1394Handle(), 300 this->armHandlerLowLevel ); 301 302 // utility handle (used to read the CTR register) 265 303 m_util_handle = raw1394_new_handle_on_port( port ); 266 304 if ( !m_util_handle ) { … … 279 317 uint32_t cycle_timer; 280 318 uint64_t local_time; 281 err =raw1394_read_cycle_timer(m_handle, &cycle_timer, &local_time);319 err = raw1394_read_cycle_timer(m_util_handle, &cycle_timer, &local_time); 282 320 if(err) { 283 321 debugOutput(DEBUG_LEVEL_VERBOSE, "raw1394_read_cycle_timer failed.\n"); … … 295 333 } 296 334 297 m_port = port;298 299 335 // obtain port name 300 336 raw1394handle_t tmp_handle = raw1394_new_handle(); … … 323 359 // set userdata 324 360 raw1394_set_userdata( m_handle, this ); 325 raw1394_set_userdata( m_resetHandle, this );326 361 raw1394_set_userdata( m_util_handle, this ); 327 raw1394_set_bus_reset_handler( m_resetHandle, 328 this->resetHandlerLowLevel ); 329 330 m_default_arm_handler = raw1394_set_arm_tag_handler( m_resetHandle, 331 this->armHandlerLowLevel ); 332 362 363 // increase the split-transaction timeout if required (e.g. for bebob's) 333 364 int split_timeout = IEEE1394SERVICE_MIN_SPLIT_TIMEOUT_USECS; 334 365 if(m_configuration) { … … 371 402 return false; 372 403 } 373 374 startRHThread();375 404 376 405 // make sure that the thread parameters of all our helper threads are OK … … 393 422 rt, priority); 394 423 result &= m_pIsoManager->setThreadParameters(rt, priority); 395 } 424 } //else debugError("Bogus isomanager\n"); 396 425 if (m_pCTRHelper) { 397 426 debugOutput(DEBUG_LEVEL_VERBOSE, "Switching CycleTimerHelper to (rt=%d, prio=%d)\n", … … 400 429 result &= m_pCTRHelper->setThreadParameters(rt && IEEE1394SERVICE_CYCLETIMER_HELPER_RUN_REALTIME, 401 430 IEEE1394SERVICE_CYCLETIMER_HELPER_PRIO); 402 } 431 } //else debugError("Bogus CTR helper\n"); 432 if(m_armHelperRealtime) { 433 m_armHelperRealtime->setThreadParameters(rt, priority); 434 } //else debugError("Bogus RT ARM helper\n"); 403 435 return result; 404 436 } … … 1001 1033 { 1002 1034 raw1394_update_generation ( handle, generation ); 1003 Ieee1394Service* instance 1004 = (Ieee1394Service*) raw1394_get_userdata( handle ); 1005 instance->resetHandler( generation ); 1035 1036 Ieee1394Service::HelperThread *thread = reinterpret_cast<Ieee1394Service::HelperThread *>(raw1394_get_userdata( handle )); 1037 if(thread == NULL) { 1038 debugFatal("Bogus 1394 handle private data\n"); 1039 return -1; 1040 } 1041 1042 Ieee1394Service& service = thread->get1394Service(); 1043 service.resetHandler( generation ); 1006 1044 1007 1045 return 0; … … 1038 1076 h, h->getStart(), h->getLength()); 1039 1077 1040 int err=raw1394_arm_register(m_resetHandle, h->getStart(), 1041 h->getLength(), h->getBuffer(), (octlet_t)h, 1042 h->getAccessRights(), 1043 h->getNotificationOptions(), 1044 h->getClientTransactions()); 1078 // FIXME: note that this will result in the ARM handlers not running in a realtime context 1079 int err = raw1394_arm_register(m_armHelperNormal->get1394Handle(), h->getStart(), 1080 h->getLength(), h->getBuffer(), (octlet_t)h, 1081 h->getAccessRights(), 1082 h->getNotificationOptions(), 1083 h->getClientTransactions()); 1045 1084 if (err) { 1046 1085 debugError("Failed to register ARM handler for 0x%016llX\n", h->getStart()); … … 1048 1087 return false; 1049 1088 } 1050 1051 1089 m_armHandlers.push_back( h ); 1052 1053 1090 return true; 1054 1091 } … … 1063 1100 { 1064 1101 if((*it) == h) { 1065 int err =raw1394_arm_unregister(m_resetHandle, h->getStart());1102 int err = raw1394_arm_unregister(m_armHelperNormal->get1394Handle(), h->getStart()); 1066 1103 if (err) { 1067 1104 debugError("Failed to unregister ARM handler (%p)\n", h); … … 1092 1129 const int maxcnt=10; 1093 1130 int err=1; 1131 Util::MutexLockHelper lock(*m_handle_lock); 1094 1132 while(err && cnt++ < maxcnt) { 1095 1133 // try to register 1096 err =raw1394_arm_register(m_resetHandle, start, length, 0, 0, 0, 0, 0);1134 err = raw1394_arm_register(m_handle, start, length, 0, 0, 0, 0, 0); 1097 1135 1098 1136 if (err) { … … 1102 1140 } else { 1103 1141 debugOutput(DEBUG_LEVEL_VERBOSE, " -> use 0x%016llX\n", start); 1104 err =raw1394_arm_unregister(m_resetHandle, start);1142 err = raw1394_arm_unregister(m_handle, start); 1105 1143 if (err) { 1106 1144 debugOutput(DEBUG_LEVEL_VERBOSE, " error unregistering test handler\n"); … … 1117 1155 int 1118 1156 Ieee1394Service::armHandlerLowLevel(raw1394handle_t handle, 1119 unsigned long arm_tag, 1120 byte_t request_type, unsigned int requested_length, 1121 void *data) 1122 { 1123 Ieee1394Service* instance 1124 = (Ieee1394Service*) raw1394_get_userdata( handle ); 1125 instance->armHandler( arm_tag, request_type, requested_length, data ); 1126 1127 return 0; 1157 unsigned long arm_tag, 1158 byte_t request_type, unsigned int requested_length, 1159 void *data) 1160 { 1161 Ieee1394Service::HelperThread *thread = reinterpret_cast<Ieee1394Service::HelperThread *>(raw1394_get_userdata( handle )); 1162 if(thread == NULL) { 1163 debugFatal("Bogus 1394 handle private data\n"); 1164 return -1; 1165 } 1166 1167 Ieee1394Service& service = thread->get1394Service(); 1168 if(service.armHandler( arm_tag, request_type, requested_length, data )) { 1169 return 0; 1170 } else { 1171 return -1; 1172 } 1128 1173 } 1129 1174 … … 1139 1184 if((*it) == (ARMHandler *)arm_tag) { 1140 1185 struct raw1394_arm_request_response *arm_req_resp; 1141 arm_req_resp 1142 raw1394_arm_request_t arm_req =arm_req_resp->request;1143 raw1394_arm_response_t arm_resp =arm_req_resp->response;1186 arm_req_resp = (struct raw1394_arm_request_response *) data; 1187 raw1394_arm_request_t arm_req = arm_req_resp->request; 1188 raw1394_arm_response_t arm_resp = arm_req_resp->response; 1144 1189 1145 1190 debugOutput(DEBUG_LEVEL_VERBOSE,"ARM handler for address 0x%016llX called\n", 1146 1191 (*it)->getStart()); 1147 debugOutput(DEBUG_LEVEL_VERBOSE," request type : 0x%02X\n", request_type);1148 debugOutput(DEBUG_LEVEL_VERBOSE," request length : %04d\n", requested_length);1192 debugOutput(DEBUG_LEVEL_VERBOSE," request type : 0x%02X\n", request_type); 1193 debugOutput(DEBUG_LEVEL_VERBOSE," request length : %04d\n", requested_length); 1149 1194 1150 1195 switch(request_type) { 1151 1196 case RAW1394_ARM_READ: 1152 1197 (*it)->handleRead(arm_req); 1153 *arm_resp =*((*it)->getResponse());1198 *arm_resp = *((*it)->getResponse()); 1154 1199 break; 1155 1200 case RAW1394_ARM_WRITE: 1156 1201 (*it)->handleWrite(arm_req); 1157 *arm_resp =*((*it)->getResponse());1202 *arm_resp = *((*it)->getResponse()); 1158 1203 break; 1159 1204 case RAW1394_ARM_LOCK: 1160 1205 (*it)->handleLock(arm_req); 1161 *arm_resp =*((*it)->getResponse());1206 *arm_resp = *((*it)->getResponse()); 1162 1207 break; 1163 1208 default: 1164 1209 debugWarning("Unknown request type received, ignoring...\n"); 1165 1210 } 1166 1167 1211 return true; 1168 1212 } … … 1171 1215 debugOutput(DEBUG_LEVEL_VERBOSE,"default ARM handler called\n"); 1172 1216 1173 m_default_arm_handler(m_ resetHandle, arm_tag, request_type, requested_length, data );1217 m_default_arm_handler(m_armHelperNormal->get1394Handle(), arm_tag, request_type, requested_length, data ); 1174 1218 return true; 1175 }1176 1177 bool1178 Ieee1394Service::startRHThread()1179 {1180 int i;1181 1182 if ( m_threadRunning ) {1183 return true;1184 }1185 m_RHThread_lock->Lock();1186 i = pthread_create( &m_thread, 0, rHThread, this );1187 m_RHThread_lock->Unlock();1188 if (i) {1189 debugFatal("Could not start ieee1394 service thread\n");1190 return false;1191 }1192 m_threadRunning = true;1193 1194 return true;1195 }1196 1197 void1198 Ieee1394Service::stopRHThread()1199 {1200 if ( m_threadRunning ) {1201 // wait for the thread to finish it's work1202 m_RHThread_lock->Lock();1203 pthread_cancel (m_thread);1204 pthread_join (m_thread, 0);1205 m_RHThread_lock->Unlock();1206 m_threadRunning = false;1207 }1208 }1209 1210 void*1211 Ieee1394Service::rHThread( void* arg )1212 {1213 Ieee1394Service* pIeee1394Service = (Ieee1394Service*) arg;1214 1215 while (true) {1216 // protect ourselves from dying1217 {1218 // use a scoped lock such that it is unlocked1219 // even if we are cancelled while running1220 // FIXME: check if this is true!1221 // Util::MutexLockHelper lock(*(pIeee1394Service->m_RHThread_lock));1222 raw1394_loop_iterate (pIeee1394Service->m_resetHandle);1223 }1224 pthread_testcancel ();1225 }1226 1227 return 0;1228 1219 } 1229 1220 … … 1548 1539 if (m_pIsoManager) m_pIsoManager->dumpInfo(); 1549 1540 } 1541 1542 // the helper thread class 1543 Ieee1394Service::HelperThread::HelperThread(Ieee1394Service &parent, std::string name) 1544 : m_parent( parent ) 1545 , m_name( name ) 1546 , m_handle( NULL ) 1547 , m_thread( *(new Util::PosixThread(this, name, false, 0, PTHREAD_CANCEL_DEFERRED)) ) 1548 , m_iterate( false ) 1549 , m_debugModule(parent.m_debugModule) 1550 { 1551 m_handle = raw1394_new_handle_on_port( parent.m_port ); 1552 if(!m_handle) { 1553 debugError("Could not allocate handle\n"); 1554 // FIXME: better error handling required 1555 } 1556 raw1394_set_userdata( m_handle, this ); 1557 } 1558 1559 Ieee1394Service::HelperThread::HelperThread(Ieee1394Service &parent, std::string name, bool rt, int prio) 1560 : m_parent( parent ) 1561 , m_name( name ) 1562 , m_handle( NULL ) 1563 , m_thread( *(new Util::PosixThread(this, name, rt, prio, PTHREAD_CANCEL_DEFERRED)) ) 1564 , m_iterate( false ) 1565 , m_debugModule(parent.m_debugModule) 1566 { 1567 m_handle = raw1394_new_handle_on_port( parent.m_port ); 1568 if(!m_handle) { 1569 debugError("Could not allocate handle\n"); 1570 // FIXME: better error handling required 1571 } 1572 raw1394_set_userdata( m_handle, this ); 1573 } 1574 1575 Ieee1394Service::HelperThread::~HelperThread() 1576 { 1577 m_thread.Stop(); 1578 delete &m_thread; 1579 if(m_handle) { 1580 raw1394_destroy_handle(m_handle); 1581 } 1582 } 1583 1584 bool 1585 Ieee1394Service::HelperThread::Init() 1586 { 1587 m_iterate = true; 1588 return true; 1589 } 1590 1591 bool 1592 Ieee1394Service::HelperThread::Execute() 1593 { 1594 if(m_iterate) { 1595 int err; 1596 err = raw1394_loop_iterate (m_handle); 1597 if(err < 0) { 1598 debugError("Failed to iterate handler\n"); 1599 return false; 1600 } else { 1601 return true; 1602 } 1603 } else { 1604 Util::SystemTimeSource::SleepUsecRelative(1000); 1605 return true; 1606 } 1607 } 1608 1609 void 1610 Ieee1394Service::HelperThread::setThreadParameters(bool rt, int priority) 1611 { 1612 debugOutput( DEBUG_LEVEL_VERBOSE, "(%p) switch to: (rt=%d, prio=%d)...\n", this, rt, priority); 1613 if (priority > THREAD_MAX_RTPRIO) priority = THREAD_MAX_RTPRIO; // cap the priority 1614 if (rt) { 1615 m_thread.AcquireRealTime(priority); 1616 } else { 1617 m_thread.DropRealTime(); 1618 } 1619 } 1620 1621 bool 1622 Ieee1394Service::HelperThread::Start() 1623 { 1624 return m_thread.Start() == 0; 1625 } 1626 1627 bool 1628 Ieee1394Service::HelperThread::Stop() 1629 { 1630 // request to stop iterating 1631 m_iterate = false; 1632 // poke the handler such that the iterate() returns 1633 raw1394_wake_up(m_handle); 1634 // stop the thread 1635 return m_thread.Stop() == 0; 1636 } trunk/libffado/src/libieee1394/ieee1394service.h
r1498 r1550 29 29 #include "libutil/Functors.h" 30 30 #include "libutil/Mutex.h" 31 #include "libutil/Thread.h" 31 32 32 33 #include "debugmodule/debugmodule.h" … … 40 41 #include <string> 41 42 42 class ARMHandler;43 43 44 44 #define MAX_FCP_BLOCK_SIZE_BYTES (512) … … 54 54 55 55 class Ieee1394Service : public IEC61883 { 56 public: 57 class ARMHandler; 58 56 59 public: 57 60 Ieee1394Service(); … … 392 395 393 396 private: 397 // this class will create a new 1394 handle 398 // and a thread that will iterate it 399 class HelperThread : public Util::RunnableInterface 400 { 401 public: 402 HelperThread(Ieee1394Service &, std::string); 403 HelperThread(Ieee1394Service &, std::string, bool rt, int prio); 404 virtual ~HelperThread(); 405 406 raw1394handle_t get1394Handle() {return m_handle;}; 407 Ieee1394Service &get1394Service() {return m_parent;}; 408 409 virtual bool Init(); 410 virtual bool Execute(); 411 412 void setThreadParameters(bool rt, int priority); 413 414 bool Start(); 415 bool Stop(); 416 417 private: 418 Ieee1394Service &m_parent; 419 std::string m_name; 420 raw1394handle_t m_handle; 421 Util::Thread & m_thread; 422 bool m_iterate; 423 424 DECLARE_DEBUG_MODULE_REFERENCE; 425 }; 426 427 HelperThread *m_resetHelper; 428 HelperThread *m_armHelperNormal; 429 HelperThread *m_armHelperRealtime; 430 431 private: // unsorted 394 432 bool configurationUpdated(); 395 396 bool startRHThread();397 void stopRHThread();398 static void* rHThread( void* arg );399 433 400 434 void printBuffer( unsigned int level, size_t length, fb_quadlet_t* buffer ) const; … … 414 448 raw1394handle_t m_handle; 415 449 Util::Mutex* m_handle_lock; 416 raw1394handle_t m_resetHandle; 417 raw1394handle_t m_util_handle; // a handle for operations from the rt thread 450 raw1394handle_t m_util_handle; 418 451 int m_port; 419 452 std::string m_portName; 420 421 pthread_t m_thread;422 Util::Mutex* m_RHThread_lock;423 bool m_threadRunning;424 453 425 454 bool m_realtime; … … 487 516 private: 488 517 DECLARE_DEBUG_MODULE; 518 519 public: 520 /** 521 * @brief Class to handle AddressRangeMappings 522 * 523 * This class is intended to help with implementing 524 * address range mapping, i.e. implementing handlers 525 * that react to reads/writes of certain addresses 526 * in 1394 memory space 527 * 528 * see the _arm_ functions in raw1394.h for more insight 529 * 530 */ 531 532 class ARMHandler { 533 public: 534 ARMHandler(Ieee1394Service &parent, 535 nodeaddr_t start, size_t length, 536 unsigned int access_rights, 537 unsigned int notification_options, 538 unsigned int client_transactions 539 ); 540 541 virtual ~ARMHandler(); 542 543 virtual bool handleRead(struct raw1394_arm_request *); 544 virtual bool handleWrite(struct raw1394_arm_request *); 545 virtual bool handleLock(struct raw1394_arm_request *); 546 547 struct raw1394_arm_response *getResponse() {return &m_response;}; 548 549 nodeaddr_t getStart() {return m_start;}; 550 size_t getLength() {return m_length;}; 551 unsigned int getAccessRights() {return m_access_rights;}; 552 unsigned int getNotificationOptions() {return m_notification_options;}; 553 unsigned int getClientTransactions() {return m_client_transactions;}; 554 555 byte_t *getBuffer() {return m_buffer;}; 556 557 private: 558 Ieee1394Service &m_parent; 559 nodeaddr_t m_start; 560 size_t m_length; 561 unsigned int m_access_rights; 562 unsigned int m_notification_options; 563 unsigned int m_client_transactions; 564 protected: 565 byte_t *m_buffer; 566 567 struct raw1394_arm_response m_response; 568 569 void printBufferBytes( unsigned int level, size_t length, byte_t* buffer ) const; 570 void printRequest(struct raw1394_arm_request *arm_req); 571 572 DECLARE_DEBUG_MODULE_REFERENCE; 573 574 }; 575 489 576 }; 490 577 trunk/libffado/src/libieee1394/IsoHandlerManager.cpp
r1535 r1550 97 97 { 98 98 bool retval = true; 99 if(!m_running) { 100 // nothing to do here 101 return true; 102 } 99 103 m_in_busreset = true; 100 104 requestShadowMapUpdate(); 101 if(request_update) {102 debugError("shadow map update request not honored\n");103 return false;104 }105 105 106 106 unsigned int i, max; … … 122 122 m_in_busreset = false; 123 123 requestShadowMapUpdate(); 124 if(request_update) {125 debugError("shadow map update request not honored\n");126 return false;127 }128 124 return retval; 129 125 } trunk/libffado/src/libieee1394/vendor_model_ids.h
r1514 r1550 40 40 #define FW_VENDORID_ALESIS 0x000595 41 41 #define FW_VENDORID_WEISS 0x001C6A 42 #define FW_VENDORID_STANTON 0x001260 42 43 43 44 // this is the one we assign ourselves … … 45 46 #define FW_VENDORID_FFADO 0x0B0001 46 47 47 48 48 #endif /* VENDOR_MODEL_IDS */ trunk/libffado/src/libutil/ByteSwap.h
r1498 r1550 58 58 } 59 59 60 static inline void 61 byteSwapBlock(quadlet_t *data, unsigned int nb_elements) 62 { 63 unsigned int i=0; 64 for(; i<nb_elements; i++) { 65 *data = ByteSwap32(*data); 66 data++; 67 } 68 } 60 69 61 70 #if __BYTE_ORDER == __BIG_ENDIAN … … 254 263 byteSwapToBus(quadlet_t *data, unsigned int nb_elements) 255 264 { 256 unsigned int i=0; 257 for(; i<nb_elements; i++) { 258 *data = ByteSwap32(*data); 259 data++; 260 } 265 byteSwapBlock(data, nb_elements); 261 266 } 262 267 … … 264 269 byteSwapFromBus(quadlet_t *data, unsigned int nb_elements) 265 270 { 266 unsigned int i=0; 267 for(; i<nb_elements; i++) { 268 *data = ByteSwap32(*data); 269 data++; 270 } 271 byteSwapBlock(data, nb_elements); 271 272 } 272 273 trunk/libffado/src/libutil/PosixThread.cpp
r1498 r1550 64 64 int err; 65 65 66 obj->m_lock.Lock(); 67 66 68 if ((err = pthread_setcanceltype(obj->fCancellation, NULL)) != 0) { 67 69 debugError("pthread_setcanceltype err = %s\n", strerror(err)); … … 78 80 // If Init succeed start the thread loop 79 81 bool res = true; 82 83 obj->m_lock.Unlock(); 80 84 while (obj->fRunning && res) { 81 85 debugOutputExtreme( DEBUG_LEVEL_VERY_VERBOSE, "(%s) ThreadHandler: run %p\n", obj->m_id.c_str(), obj); … … 140 144 } 141 145 142 if ((res = pthread_create(&fThread, &attributes, ThreadHandler, this))) { 146 m_lock.Lock(); 147 res = pthread_create(&fThread, &attributes, ThreadHandler, this); 148 m_lock.Unlock(); 149 if (res) { 143 150 debugError("Cannot create realtime thread (%d: %s)\n", res, strerror(res)); 144 151 debugError(" priority: %d %s\n", fPriority); … … 150 157 debugOutput( DEBUG_LEVEL_VERBOSE, "(%s) Create non RT thread %p\n", m_id.c_str(), this); 151 158 152 if ((res = pthread_create(&fThread, 0, ThreadHandler, this))) { 159 m_lock.Lock(); 160 res = pthread_create(&fThread, 0, ThreadHandler, this); 161 m_lock.Unlock(); 162 if (res) { 153 163 debugError("Cannot create thread %d %s\n", res, strerror(res)); 154 164 return -1; … … 165 175 void* status; 166 176 pthread_cancel(fThread); 177 m_lock.Lock(); 167 178 pthread_join(fThread, &status); 179 m_lock.Unlock(); 168 180 debugOutput( DEBUG_LEVEL_VERBOSE, "(%s) Killed %p (thread: %p)\n", m_id.c_str(), this, fThread); 169 181 return 0; … … 179 191 void* status; 180 192 fRunning = false; // Request for the thread to stop 193 m_lock.Lock(); 181 194 pthread_join(fThread, &status); 195 fThread = NULL; 196 m_lock.Unlock(); 182 197 debugOutput( DEBUG_LEVEL_VERBOSE, "(%s) Stopped %p (thread: %p)\n", m_id.c_str(), this, fThread); 183 198 return 0; trunk/libffado/src/libutil/PosixThread.h
r1336 r1550 54 54 #include "Thread.h" 55 55 #include <pthread.h> 56 #include "PosixMutex.h" 56 57 57 58 namespace Util … … 74 75 75 76 static void* ThreadHandler(void* arg); 76 77 Util::Mutex &m_lock; 77 78 public: 78 79 79 80 PosixThread(RunnableInterface* runnable, bool real_time, int priority, int cancellation) 80 81 : Thread(runnable), fThread((pthread_t)NULL), fPriority(priority), fRealTime(real_time), fRunning(false), fCancellation(cancellation) 82 , m_lock(*(new Util::PosixMutex("THREAD"))) 81 83 {} 82 84 PosixThread(RunnableInterface* runnable) 83 85 : Thread(runnable), fThread((pthread_t)NULL), fPriority(0), fRealTime(false), fRunning(false), fCancellation(PTHREAD_CANCEL_DEFERRED) 86 , m_lock(*(new Util::PosixMutex("THREAD"))) 84 87 {} 85 88 PosixThread(RunnableInterface* runnable, int cancellation) 86 89 : Thread(runnable), fThread((pthread_t)NULL), fPriority(0), fRealTime(false), fRunning(false), fCancellation(cancellation) 90 , m_lock(*(new Util::PosixMutex("THREAD"))) 87 91 {} 88 92 89 93 PosixThread(RunnableInterface* runnable, std::string id, bool real_time, int priority, int cancellation) 90 94 : Thread(runnable, id), fThread((pthread_t)NULL), fPriority(priority), fRealTime(real_time), fRunning(false), fCancellation(cancellation) 95 , m_lock(*(new Util::PosixMutex(id))) 91 96 {} 92 97 PosixThread(RunnableInterface* runnable, std::string id) 93 98 : Thread(runnable, id), fThread((pthread_t)NULL), fPriority(0), fRealTime(false), fRunning(false), fCancellation(PTHREAD_CANCEL_DEFERRED) 99 , m_lock(*(new Util::PosixMutex(id))) 94 100 {} 95 101 PosixThread(RunnableInterface* runnable, std::string id, int cancellation) 96 102 : Thread(runnable, id), fThread((pthread_t)NULL), fPriority(0), fRealTime(false), fRunning(false), fCancellation(cancellation) 103 , m_lock(*(new Util::PosixMutex(id))) 97 104 {} 98 105 99 106 virtual ~PosixThread() 100 { }107 { delete &m_lock; } 101 108 102 109 virtual int Start(); trunk/libffado/src/SConscript
r1543 r1550 113 113 genericavc_source = env.Split( '\ 114 114 genericavc/avc_avdevice.cpp \ 115 genericavc/stanton/scs.cpp \ 115 116 ' ) 116 117 … … 156 157 dice_source = env.Split( '\ 157 158 dice/dice_avdevice.cpp \ 159 dice/dice_eap.cpp \ 158 160 ' ) 159 161 trunk/libffado/support/alsa/SConscript
r1491 r1550 35 35 36 36 #if not env.GetOption( "clean" ): 37 env.MergeFlags( env["ALSA_FLAGS"] )38 env.MergeFlags( "-DPIC" )39 40 37 sources = ["alsa_plugin.cpp"] 41 38 42 39 if env['ALSA_FLAGS']: 40 env.MergeFlags( env["ALSA_FLAGS"] ) 41 env.MergeFlags( "-DPIC" ) 43 42 alsaplugin = env.SharedLibrary( "asound_module_pcm_ffado", sources ) trunk/libffado/tests/scan-devreg.cpp
r1234 r1550 44 44 #define MAX_ARGS 1000 45 45 46 #define MOTU_BASE_ADDR 0xfffff0000000ULL47 46 // #define SCAN_BASE_ADDR 0xffff00000000ULL 47 #define SCAN_BASE_ADDR 0xFFFFE0200000ULL 48 48 // If changing these be sure to update the option help text 49 49 #define DEFAULT_SCAN_START_REG 0x0b00 … … 84 84 signed int verbose; 85 85 bool test; 86 signed int port;87 signed int node;88 signed int scan_start;89 signed int scan_length;86 signed int port; 87 signed int node; 88 signed long long int scan_start; 89 signed long long int scan_length; 90 90 } arguments; 91 91 … … 113 113 case 's': 114 114 errno = 0; 115 arguments->scan_start = strtol (arg, &tail, 0);115 arguments->scan_start = strtoll(arg, &tail, 0); 116 116 if (errno) { 117 117 perror("argument parsing failed:"); … … 125 125 case 'l': 126 126 errno = 0; 127 arguments->scan_length = strtol (arg, &tail, 0);127 arguments->scan_length = strtoll(arg, &tail, 0); 128 128 if (errno) { 129 129 perror("argument parsing failed:"); … … 232 232 // only MOTU devices but this can be expanded on an as-needs 233 233 // basis. 234 if (configRom->getNodeVendorId() == 0x1f2) { 234 // if (configRom->getNodeVendorId() == 0x1f2) { 235 if (configRom->getNodeVendorId() == 0x0000130E) { 235 236 node_id = node; 236 237 port = i; … … 262 263 263 264 quadlet_t old_vals[arguments.scan_length/4+1], quadlet; 264 unsigned int present[arguments.scan_length/(4*32)+1];265 char present[arguments.scan_length/4+1]; 265 266 memset(old_vals, 0x00, sizeof(old_vals)); 266 267 // Assume all registers are present until proven otherwise 267 268 memset(present, 0xff, sizeof(present)); 268 269 270 printf("Scanning from %012llX to %012llX (len: %lld)\n", 271 SCAN_BASE_ADDR + arguments.scan_start, 272 SCAN_BASE_ADDR + arguments.scan_start + arguments.scan_length, 273 arguments.scan_length); 269 274 printf("Scanning initial register values, please wait\n"); 270 275 chr[0] = 0; 271 276 while(chr[0]!='q') { 272 for (signed int reg=arguments.scan_start; 273 reg<arguments.scan_start+arguments.scan_length; reg+=4) { 274 unsigned int reg_index = (reg-arguments.scan_start)/4; 275 unsigned int pres_index = (reg-arguments.scan_start)/(4*32); 276 unsigned int pres_bit = ((reg-arguments.scan_start)/4) & 0x1f; 277 278 if (!(present[pres_index] & (1<<pres_bit))) { 277 for (signed long long int reg=arguments.scan_start; 278 reg < arguments.scan_start + arguments.scan_length; reg+=4) { 279 unsigned long long int reg_index = (reg - arguments.scan_start)/4; 280 281 if (present[reg_index] == 0) { 279 282 continue; 280 283 } 281 284 282 if (m_1394Service->read(0xffc0 | node_id, MOTU_BASE_ADDR+reg, 1, &quadlet) <= 0) {285 if (m_1394Service->read(0xffc0 | node_id, SCAN_BASE_ADDR+reg, 1, &quadlet) <= 0) { 283 286 // Flag the register as not being present so we don't keep trying to read it 284 present[pres_index] &= ~(1<<pres_bit); 287 present[reg_index] = 0; 288 printf("Register %012llX: failed\n", SCAN_BASE_ADDR+reg); 285 289 continue; 286 290 } else { 287 291 quadlet = CondSwapFromBus32(quadlet); 288 } 289 292 char bitvector[33]; 293 bitvector[32] = 0; 294 for (int i=0; i<32; i++) { 295 if (quadlet & (1<<(31-i))) { 296 bitvector[i] = '1'; 297 } else { 298 bitvector[i] = '0'; 299 } 300 } 301 char bitvector_spaced[33+7]; 302 bitvector_spaced[32+7] = 0; 303 int cnt=0; 304 for (int i=0; i<32; i++) { 305 if (i % 4 == 0 && i) { 306 bitvector_spaced[cnt] = ' '; 307 cnt++; 308 } 309 bitvector_spaced[cnt] = bitvector[i]; 310 cnt++; 311 } 312 printf("Register [%06lld] %012llX: %08X [%10u] [%s] [%10d %10d]\n", 313 (reg-arguments.scan_start)/4, SCAN_BASE_ADDR+reg, 314 quadlet, quadlet, 315 bitvector_spaced, 316 (quadlet>>16) & 0xFFFF, quadlet & 0xFFFF); 317 } 318 290 319 if (old_vals[reg_index] != quadlet) { 291 320 if (loop != 0) { 292 printf("0x%0 4x changed from %08X to %08X\n",reg, old_vals[reg_index], quadlet);321 printf("0x%012llx changed from %08X to %08X\n", SCAN_BASE_ADDR+reg, old_vals[reg_index], quadlet); 293 322 } 294 323 old_vals[reg_index] = quadlet; trunk/libffado/tests/SConscript
r1498 r1550 66 66 if env['ENABLE_BEBOB']: 67 67 apps.update( { "test-focusrite" : "test-focusrite.cpp" } ) 68 if env['ENABLE_GENERICAVC']: 69 env.MergeFlags( env["ALSA_FLAGS"] ) # FIXME: only used here 70 apps.update( { "test-scs" : "test-scs.cpp" } ) 68 71 if env['ENABLE_FIREWORKS']: 69 72 apps.update( { "test-echomixer" : "test-echomixer.cpp" } ) 73 if env['ENABLE_DICE']: 74 apps.update( { "test-dice-eap" : "test-dice-eap.cpp" } ) 70 75 71 76 for app in apps.keys(): trunk/libffado/tests/test-ieee1394service.cpp
r1498 r1550 41 41 #include "src/libieee1394/configrom.h" 42 42 #include "src/libieee1394/ieee1394service.h" 43 #include "src/libieee1394/ARMHandler.h"44 43 45 44 #include "src/libutil/Thread.h" … … 343 342 nodeaddr_t addr = m_service->findFreeARMBlock(0x0000FFFFE0000000ULL, 4, 4 ); 344 343 345 ARMHandler *test_arm=new ARMHandler(addr,346 4,347 RAW1394_ARM_READ | RAW1394_ARM_WRITE | RAW1394_ARM_LOCK,348 RAW1394_ARM_READ | RAW1394_ARM_WRITE | RAW1394_ARM_LOCK,349 0);344 Ieee1394Service::ARMHandler *test_arm = new Ieee1394Service::ARMHandler(*m_service, addr, 345 4, 346 RAW1394_ARM_READ | RAW1394_ARM_WRITE | RAW1394_ARM_LOCK, 347 RAW1394_ARM_READ | RAW1394_ARM_WRITE | RAW1394_ARM_LOCK, 348 0); 350 349 351 350 printf(" adding (%p) as arm handler\n", test_arm); … … 357 356 addr = m_service->findFreeARMBlock(0x0000FFFFE0000000ULL, 4, 4 ); 358 357 359 ARMHandler *test_arm2=new ARMHandler(addr,360 4,361 RAW1394_ARM_READ | RAW1394_ARM_WRITE | RAW1394_ARM_LOCK,362 RAW1394_ARM_READ | RAW1394_ARM_WRITE | RAW1394_ARM_LOCK,363 0);358 Ieee1394Service::ARMHandler *test_arm2 = new Ieee1394Service::ARMHandler(*m_service, addr, 359 4, 360 RAW1394_ARM_READ | RAW1394_ARM_WRITE | RAW1394_ARM_LOCK, 361 RAW1394_ARM_READ | RAW1394_ARM_WRITE | RAW1394_ARM_LOCK, 362 0); 364 363 365 364 printf(" adding (%p) as arm handler\n", test_arm2);