Changeset 1689
- Timestamp:
- 10/16/09 05:14:30 (13 years ago)
- Files:
-
- trunk/libffado/src/rme/fireface_def.h (modified) (1 diff)
- trunk/libffado/src/rme/rme_avdevice.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/src/rme/fireface_def.h
r1657 r1689 299 299 #define SR0_AUTOSYNC_SRC_WCLK SR0_SEL_SYNC_REF2 300 300 #define SR0_AUTOSYNC_SRC_TCO (SR0_SEL_SYNC_REF0|SR0_SEL_SYNC_REF2) 301 #define SR0_AUTOSYNC_SRC_NONE (SR0_SEL_SYNC_REF1|SR0_SEL_SYNC_REF2) 301 302 302 303 #define SR0_AUTOSYNC_FREQ_MASK (SR0_INP_FREQ0|SR0_INP_FREQ1|SR0_INP_FREQ2|SR0_INP_FREQ3) trunk/libffado/src/rme/rme_avdevice.cpp
r1688 r1689 520 520 521 521 signed int mult, bandwidth; 522 signed int freq ;522 signed int freq, init_samplerate; 523 523 signed int err = 0; 524 unsigned int stat[4]; 524 525 525 526 debugOutput(DEBUG_LEVEL_NORMAL, "Preparing Device...\n" ); … … 533 534 // The number of frames transmitted in a single packet is solely 534 535 // determined by the sample rate. 535 mult = multiplier_of_freq( getSamplingFrequency());536 mult = multiplier_of_freq(freq); 536 537 switch (mult) { 537 538 case 2: frames_per_packet = 15; break; … … 564 565 bandwidth = 25 + num_channels*4*frames_per_packet; 565 566 566 // Both the FF400 and FF800 require we allocate a tx iso channel. The 567 // rx channel is also allocated for the FF400. The FF800 chooses 568 // the rx channel to be used but does not handle the bus-level 569 // channel/bandwidth allocation. 567 // Both the FF400 and FF800 require we allocate a tx iso channel and 568 // then initialise the device. Device status is then read at least once 569 // regardless of which interface is in use. The rx channel is then 570 // allocated for the FF400 or acquired from the device in the case of 571 // the FF800. Even though the FF800 chooses the rx channel it does not 572 // handle the bus-level channel/bandwidth allocation so we must do that 573 // here. 570 574 if (iso_tx_channel < 0) { 571 575 iso_tx_channel = get1394Service().allocateIsoChannelGeneric(bandwidth); 572 576 } 573 574 if (iso_rx_channel < 0) { 575 if (m_rme_model == RME_MODEL_FIREFACE800) { 576 unsigned int stat[4]; 577 get_hardware_streaming_status(stat, 4); 578 // CHECKME: does this work before streaming has been initialised? 579 iso_rx_channel = stat[2] & 63; 580 iso_rx_channel = get1394Service().allocateFixedIsoChannelGeneric(iso_rx_channel, bandwidth); 581 } else { 582 iso_rx_channel = get1394Service().allocateIsoChannelGeneric(bandwidth); 577 if (iso_tx_channel < 0) { 578 debugFatal("Could not allocate iso tx channel\n"); 579 return false; 580 } 581 582 err = hardware_init_streaming(dev_config->hardware_freq, iso_tx_channel) != 0; 583 if (err) { 584 debugFatal("Could not intialise device streaming system\n"); 585 } 586 587 if (err == 0) { 588 signed int i; 589 for (i=0; i<100; i++) { 590 err = (get_hardware_streaming_status(stat, 4) != 0); 591 if (err) { 592 debugFatal("error reading status register\n"); 593 break; 594 } 595 if (m_rme_model == RME_MODEL_FIREFACE400) { 596 iso_rx_channel = get1394Service().allocateIsoChannelGeneric(bandwidth); 597 break; 598 } 599 // The Fireface-800 chooses its tx channel (our rx channel). 600 if (stat[2] == -1) { 601 // Device not ready; wait 5 ms and try again 602 usleep(5000); 603 } else { 604 iso_rx_channel = stat[2] & 63; 605 iso_rx_channel = get1394Service().allocateFixedIsoChannelGeneric(iso_rx_channel, bandwidth); 606 } 583 607 } 608 if (iso_rx_channel < 0) { 609 debugFatal("Could not allocate/determine iso rx channel\n"); 610 err = 1; 611 } 584 612 } 585 613 586 if (iso_tx_channel>=0 && iso_rx_channel>=0) {587 err = hardware_init_streaming(dev_config->hardware_freq, iso_tx_channel) != 0;588 if (err) {589 debugFatal("Could not intialise device streaming system\n");590 }591 } else {592 err = 1;593 debugFatal("Could not allocate iso channels\n");594 }595 596 614 if (err) { 597 615 if (iso_tx_channel >= 0) … … 602 620 } 603 621 622 if ((stat[1] & SR1_CLOCK_MODE_MASTER) || 623 (stat[0] & SR0_AUTOSYNC_FREQ_MASK)==0 || 624 (stat[0] & SR0_AUTOSYNC_SRC_MASK)==SR0_AUTOSYNC_SRC_NONE) { 625 init_samplerate = dev_config->hardware_freq; 626 } else { 627 init_samplerate = (stat[0] & SR0_STREAMING_FREQ_MASK) * 250; 628 } 629 630 debugOutput(DEBUG_LEVEL_VERBOSE, "sample rate on start: %d\n", 631 init_samplerate); 632 604 633 // get the device specific and/or global SP configuration 605 634 Util::Configuration &config = getDeviceManager().getConfiguration(); … … 618 647 // Set up receive stream processor, initialise it and set DLL bw 619 648 // TODO: set event_size properly; the value below is just a placeholder. 620 signed int event_size = 0x1 50;649 signed int event_size = 0x1000; 621 650 #warning event_size needs setting up 622 651 m_receiveProcessor = new Streaming::RmeReceiveStreamProcessor(*this,