Changeset 1671
- Timestamp:
- 09/19/09 05:02:54 (14 years ago)
- Files:
-
- trunk/libffado/src/rme/fireface_hw.cpp (modified) (5 diffs)
- trunk/libffado/src/rme/rme_avdevice.cpp (modified) (5 diffs)
- trunk/libffado/src/rme/rme_shm.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/src/rme/fireface_hw.cpp
r1629 r1671 619 619 620 620 return write_tco(tc, 4); 621 622 return 0;623 621 } 624 622 … … 638 636 else 639 637 ret = writeRegister(RME_FF800_STREAM_SRATE, freq); 638 639 if (ret == 0) 640 dev_config->hardware_freq = freq; 640 641 641 642 return ret; … … 674 675 Device::hardware_start_streaming(unsigned int listen_channel) 675 676 { 677 signed int ret = 0; 676 678 // Listen_channel is the ISO channel the PC will listen on for data sent 677 679 // by the Fireface. … … 679 681 quadlet_t data = num_channels; 680 682 681 if (m_rme_model == RME_MODEL_FIREFACE400) { 682 addr = RME_FF400_STREAM_START_REG; 683 data |= (listen_channel << 5); 684 } else { 685 addr = RME_FF800_STREAM_START_REG; 686 if (speed800) 687 data |= RME_FF800_STREAMING_SPEED_800; // Flag 800 Mbps speed 688 } 689 690 return writeRegister(addr, data); 683 config_lock(); 684 if (not(hardware_is_streaming())) { 685 if (m_rme_model == RME_MODEL_FIREFACE400) { 686 addr = RME_FF400_STREAM_START_REG; 687 data |= (listen_channel << 5); 688 } else { 689 addr = RME_FF800_STREAM_START_REG; 690 if (speed800) 691 data |= RME_FF800_STREAMING_SPEED_800; // Flag 800 Mbps speed 692 } 693 694 ret = writeRegister(addr, data); 695 if (ret != 0) { 696 dev_config->is_streaming = 1; 697 } 698 } else 699 ret = -1; 700 config_unlock(); 701 702 return ret; 691 703 } 692 704 … … 696 708 fb_nodeaddr_t addr; 697 709 quadlet_t buf[4] = {0, 0, 0, 1}; 698 unsigned int size; 699 700 if (m_rme_model == RME_MODEL_FIREFACE400) { 701 addr = RME_FF400_STREAM_END_REG; 702 size = RME_FF400_STREAM_END_SIZE; 703 } else { 704 addr = RME_FF800_STREAM_END_REG; 705 size = RME_FF800_STREAM_END_SIZE; 706 } 707 708 return writeBlock(addr, buf, size); 710 unsigned int size, ret = 0; 711 712 config_lock(); 713 if (hardware_is_streaming()) { 714 if (m_rme_model == RME_MODEL_FIREFACE400) { 715 addr = RME_FF400_STREAM_END_REG; 716 size = RME_FF400_STREAM_END_SIZE; 717 } else { 718 addr = RME_FF800_STREAM_END_REG; 719 size = RME_FF800_STREAM_END_SIZE; 720 } 721 722 ret = writeBlock(addr, buf, size); 723 if (ret != 0) { 724 dev_config->is_streaming = 0; 725 } 726 } else 727 ret = -1; 728 config_unlock(); 729 730 return ret; 709 731 } 710 732 trunk/libffado/src/rme/rme_avdevice.cpp
r1660 r1671 25 25 #warning RME support is at an early development stage and is not functional 26 26 27 #include "config.h" 28 27 29 #include "rme/rme_avdevice.h" 28 30 #include "rme/fireface_def.h" … … 516 518 517 519 signed int mult, bandwidth; 520 signed int freq; 521 signed int err = 0; 518 522 519 523 debugOutput(DEBUG_LEVEL_NORMAL, "Preparing Device...\n" ); 524 525 freq = getSamplingFrequency(); 526 if (freq <= 0) { 527 debugOutput(DEBUG_LEVEL_ERROR, "Can't continue: sampling frequency not set\n"); 528 return false; 529 } 520 530 521 531 // The number of frames transmitted in a single packet is solely … … 553 563 554 564 // Both the FF400 and FF800 require we allocate a tx iso channel. The 555 // rx channel is also allocated for the FF400 while the FF800 handles 556 // the rx channel allocation for that device. 565 // rx channel is also allocated for the FF400. The FF800 chooses 566 // the rx channel to be used but does not handle the bus-level 567 // channel/bandwidth allocation/ 557 568 if (iso_tx_channel < 0) { 558 569 iso_tx_channel = get1394Service().allocateIsoChannelGeneric(bandwidth); … … 570 581 } 571 582 } 572 573 if (iso_tx_channel<0 || iso_rx_channel<0) { 583 584 if (iso_tx_channel>=0 && iso_rx_channel>=0) { 585 err = hardware_init_streaming(dev_config->hardware_freq, iso_tx_channel) != 0; 586 if (err) { 587 debugFatal("Could not intialise device streaming system\n"); 588 } 589 } else { 590 err = 1; 591 debugFatal("Could not allocate iso channels\n"); 592 } 593 594 if (err) { 574 595 if (iso_tx_channel >= 0) 575 596 get1394Service().freeIsoChannel(iso_tx_channel); 576 597 if (iso_rx_channel >= 0) 577 598 get1394Service().freeIsoChannel(iso_rx_channel); 578 debugFatal("Could not allocate iso channels\n"); 579 return false; 580 } 581 599 return false; 600 } 601 602 // get the device specific and/or global SP configuration 603 Util::Configuration &config = getDeviceManager().getConfiguration(); 604 // base value is the config.h value 605 float recv_sp_dll_bw = STREAMPROCESSOR_DLL_BW_HZ; 606 float xmit_sp_dll_bw = STREAMPROCESSOR_DLL_BW_HZ; 607 608 // we can override that globally 609 config.getValueForSetting("streaming.spm.recv_sp_dll_bw", recv_sp_dll_bw); 610 config.getValueForSetting("streaming.spm.xmit_sp_dll_bw", xmit_sp_dll_bw); 611 612 // or override in the device section 613 config.getValueForDeviceSetting(getConfigRom().getNodeVendorId(), getConfigRom().getModelId(), "recv_sp_dll_bw", recv_sp_dll_bw); 614 config.getValueForDeviceSetting(getConfigRom().getNodeVendorId(), getConfigRom().getModelId(), "xmit_sp_dll_bw", xmit_sp_dll_bw); 615 616 // Other things to be done: 617 // * create a receive stream processor, set DLL bandwidth, add ports 618 // * create a transmit stream processor, set DLL bandwidth, add ports 582 619 583 620 return true; … … 596 633 bool 597 634 Device::startStreamByIndex(int i) { 598 return false; 635 // The RME does not allow separate enabling of the transmit and receive 636 // streams. Therefore we start all streaming when index 0 is referenced 637 // and silently ignore the start requests for other streams 638 // (unconditionally flagging them as being successful). 639 if (i == 0) { 640 if (hardware_start_streaming(iso_rx_channel) != 0) 641 return false; 642 } 643 return true; 599 644 } 600 645 601 646 bool 602 647 Device::stopStreamByIndex(int i) { 603 return false; 604 648 // See comments in startStreamByIndex() as to why we act only when stream 649 // 0 is requested. 650 if (i == 0) { 651 if (hardware_stop_streaming() != 0) 652 return false; 653 } 654 return true; 605 655 } 606 656 trunk/libffado/src/rme/rme_shm.h
r1629 r1671 40 40 signed int dds_freq; // Optionally explicitly set hardware freq 41 41 signed int software_freq; // Sampling frequency in use by software 42 signed int hardware_freq; // Frequency actually programmed into hardware 42 43 43 44 signed int is_streaming;